From 93c87853aef6c45d1b012ef7604ed2d230bcf459 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 28 Feb 2022 08:17:02 +0000 Subject: [PATCH] CodeGen from PR 17051 in Azure/azure-rest-api-specs Merge 8b809c7676bedb31a15eca563006f1100ae58db5 into 78da17edca5d8e7531dbb2655627c609b09ff6b6 --- .../src/Generated/IPrivateStoreOperations.cs | 102 ++- .../Generated/MarketplaceRPServiceClient.cs | 2 +- .../Models/NewPlansNotificationsList.cs | 51 ++ .../StopSellOffersPlansNotificationsList.cs | 53 ++ ...lOffersPlansNotificationsListProperties.cs | 115 +++ .../Generated/Models/StopSellSubscriptions.cs | 51 ++ .../src/Generated/Models/Subscription.cs | 83 ++ .../src/Generated/Models/SubscriptionState.cs | 25 + .../Models/SubscriptionsContextList.cs | 51 ++ .../Generated/Models/SubscriptionsResponse.cs | 70 ++ .../PrivateStoreCollectionOfferOperations.cs | 40 +- .../src/Generated/PrivateStoreOperations.cs | 757 +++++++++++++++++- .../PrivateStoreOperationsExtensions.cs | 166 +++- .../Generated/SdkInfo_MarketplaceRPService.cs | 19 +- 14 files changed, 1521 insertions(+), 64 deletions(-) create mode 100644 sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/NewPlansNotificationsList.cs create mode 100644 sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/StopSellOffersPlansNotificationsList.cs create mode 100644 sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/StopSellOffersPlansNotificationsListProperties.cs create mode 100644 sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/StopSellSubscriptions.cs create mode 100644 sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Subscription.cs create mode 100644 sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SubscriptionState.cs create mode 100644 sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SubscriptionsContextList.cs create mode 100644 sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SubscriptionsResponse.cs diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreOperations.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreOperations.cs index 50b35833524c..a0f9f6c9df36 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreOperations.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreOperations.cs @@ -351,15 +351,15 @@ public partial interface IPrivateStoreOperations /// /// Get open approval requests /// - /// - /// The publisher id of this offer. - /// /// /// The store ID - must use the tenant ID /// /// /// The admin request approval ID to get create or update /// + /// + /// The publisher id of this offer. + /// /// /// The headers that will be added to request. /// @@ -375,7 +375,7 @@ public partial interface IPrivateStoreOperations /// /// Thrown when a required parameter is null /// - Task> GetAdminRequestApprovalWithHttpMessagesAsync(string publisherId, string privateStoreId, string adminRequestApprovalId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetAdminRequestApprovalWithHttpMessagesAsync(string privateStoreId, string adminRequestApprovalId, string publisherId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Update the admin action, weather the request is approved or /// rejected and the approved plans @@ -475,6 +475,100 @@ public partial interface IPrivateStoreOperations /// Task WithdrawPlanWithHttpMessagesAsync(string privateStoreId, string requestApprovalId, WithdrawProperties payload = default(WithdrawProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// 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. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> FetchAllSubscriptionsInTenantWithHttpMessagesAsync(string privateStoreId, string nextPageToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List new plans notifications + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListNewPlansNotificationsWithHttpMessagesAsync(string privateStoreId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List stop sell notifications for both stop sell offers and stop + /// sell plans + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListStopSellOffersPlansNotificationsWithHttpMessagesAsync(string privateStoreId, StopSellSubscriptions stopSellSubscriptions = default(StopSellSubscriptions), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all the subscriptions in the private store context + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListSubscriptionsContextWithHttpMessagesAsync(string privateStoreId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Gets the list of available private stores. /// /// diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/MarketplaceRPServiceClient.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/MarketplaceRPServiceClient.cs index 2fdb2bd09bbc..11f66e321802 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/MarketplaceRPServiceClient.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/MarketplaceRPServiceClient.cs @@ -335,7 +335,7 @@ private void Initialize() PrivateStoreCollectionOffer = new PrivateStoreCollectionOfferOperations(this); Operations = new Operations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2021-06-01"; + ApiVersion = "2021-12-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/NewPlansNotificationsList.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/NewPlansNotificationsList.cs new file mode 100644 index 000000000000..f6ff6959c0ac --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/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.Management.Marketplace.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List of all new plans notifications for public offers + /// + public partial class NewPlansNotificationsList + { + /// + /// Initializes a new instance of the NewPlansNotificationsList class. + /// + public NewPlansNotificationsList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NewPlansNotificationsList class. + /// + public NewPlansNotificationsList(IList newPlansNotifications = default(IList)) + { + NewPlansNotifications = newPlansNotifications; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "newPlansNotifications")] + public IList NewPlansNotifications { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/StopSellOffersPlansNotificationsList.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/StopSellOffersPlansNotificationsList.cs new file mode 100644 index 000000000000..fbaa1ddf293e --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/StopSellOffersPlansNotificationsList.cs @@ -0,0 +1,53 @@ +// +// 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.Management.Marketplace.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List of stop sell offers and plans notifications. + /// + public partial class StopSellOffersPlansNotificationsList + { + /// + /// Initializes a new instance of the + /// StopSellOffersPlansNotificationsList class. + /// + public StopSellOffersPlansNotificationsList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// StopSellOffersPlansNotificationsList class. + /// + public StopSellOffersPlansNotificationsList(IList stopSellNotifications = default(IList)) + { + StopSellNotifications = stopSellNotifications; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "stopSellNotifications")] + public IList StopSellNotifications { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/StopSellOffersPlansNotificationsListProperties.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/StopSellOffersPlansNotificationsListProperties.cs new file mode 100644 index 000000000000..fcbce058cf16 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/StopSellOffersPlansNotificationsListProperties.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.Management.Marketplace.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List of stop sell offers and plans notifications. + /// + public partial class StopSellOffersPlansNotificationsListProperties + { + /// + /// Initializes a new instance of the + /// StopSellOffersPlansNotificationsListProperties class. + /// + public StopSellOffersPlansNotificationsListProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// StopSellOffersPlansNotificationsListProperties class. + /// + /// The offer id + /// The offer display name + /// A value indicating whether entire offer is + /// in stop sell or only few of its plans + /// The notification message code + /// The icon url + /// The list of removed plans notifications + /// True if the offer has public + /// plans + /// The subscriptions related to private + /// plans + public StopSellOffersPlansNotificationsListProperties(string offerId = default(string), string displayName = default(string), bool? isEntire = default(bool?), long? messageCode = default(long?), string icon = default(string), IList plans = default(IList), bool? publicContext = default(bool?), IList subscriptionsIds = default(IList)) + { + OfferId = offerId; + DisplayName = displayName; + IsEntire = isEntire; + MessageCode = messageCode; + Icon = icon; + Plans = plans; + PublicContext = publicContext; + SubscriptionsIds = subscriptionsIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the offer id + /// + [JsonProperty(PropertyName = "offerId")] + public string OfferId { get; private set; } + + /// + /// Gets the offer display name + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets a value indicating whether entire offer is in stop sell or + /// only few of its plans + /// + [JsonProperty(PropertyName = "isEntire")] + public bool? IsEntire { get; private set; } + + /// + /// Gets the notification message code + /// + [JsonProperty(PropertyName = "messageCode")] + public long? MessageCode { get; private set; } + + /// + /// Gets the icon url + /// + [JsonProperty(PropertyName = "icon")] + public string Icon { get; private set; } + + /// + /// Gets the list of removed plans notifications + /// + [JsonProperty(PropertyName = "plans")] + public IList Plans { get; private set; } + + /// + /// Gets true if the offer has public plans + /// + [JsonProperty(PropertyName = "publicContext")] + public bool? PublicContext { get; private set; } + + /// + /// Gets the subscriptions related to private plans + /// + [JsonProperty(PropertyName = "subscriptionsIds")] + public IList SubscriptionsIds { get; private set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/StopSellSubscriptions.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/StopSellSubscriptions.cs new file mode 100644 index 000000000000..cbc49cac266f --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/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.Management.Marketplace.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Private plans subscriptions + /// + public partial class StopSellSubscriptions + { + /// + /// Initializes a new instance of the StopSellSubscriptions class. + /// + public StopSellSubscriptions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StopSellSubscriptions class. + /// + public StopSellSubscriptions(IList subscriptions = default(IList)) + { + Subscriptions = subscriptions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "subscriptions")] + public IList Subscriptions { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Subscription.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Subscription.cs new file mode 100644 index 000000000000..3bcf80a6ddef --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Subscription.cs @@ -0,0 +1,83 @@ +// +// 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.Management.Marketplace.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Subscription information. + /// + public partial class Subscription + { + /// + /// Initializes a new instance of the Subscription class. + /// + public Subscription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Subscription class. + /// + /// The fully qualified ID for the subscription. For + /// example, + /// /subscriptions/00000000-0000-0000-0000-000000000000. + /// The subscription ID. + /// The subscription display name. + /// The subscription state. Possible values are + /// Enabled, Warned, PastDue, Disabled, and Deleted. Possible values + /// include: 'Enabled', 'Warned', 'PastDue', 'Disabled', + /// 'Deleted' + public Subscription(string id = default(string), string subscriptionId = default(string), string displayName = default(string), string state = default(string)) + { + Id = id; + SubscriptionId = subscriptionId; + DisplayName = displayName; + State = state; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the fully qualified ID for the subscription. For example, + /// /subscriptions/00000000-0000-0000-0000-000000000000. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the subscription ID. + /// + [JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId { get; private set; } + + /// + /// Gets the subscription display name. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets the subscription state. Possible values are Enabled, Warned, + /// PastDue, Disabled, and Deleted. Possible values include: 'Enabled', + /// 'Warned', 'PastDue', 'Disabled', 'Deleted' + /// + [JsonProperty(PropertyName = "state")] + public string State { get; private set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SubscriptionState.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SubscriptionState.cs new file mode 100644 index 000000000000..be1fc27b7ab7 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SubscriptionState.cs @@ -0,0 +1,25 @@ +// +// 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.Management.Marketplace.Models +{ + + /// + /// Defines values for SubscriptionState. + /// + public static class SubscriptionState + { + public const string Enabled = "Enabled"; + public const string Warned = "Warned"; + public const string PastDue = "PastDue"; + public const string Disabled = "Disabled"; + public const string Deleted = "Deleted"; + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SubscriptionsContextList.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SubscriptionsContextList.cs new file mode 100644 index 000000000000..b9398878bde6 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/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.Management.Marketplace.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List of subscription Ids in the private store + /// + public partial class SubscriptionsContextList + { + /// + /// Initializes a new instance of the SubscriptionsContextList class. + /// + public SubscriptionsContextList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubscriptionsContextList class. + /// + public SubscriptionsContextList(IList subscriptionsIds = default(IList)) + { + SubscriptionsIds = subscriptionsIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "subscriptionsIds")] + public IList SubscriptionsIds { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SubscriptionsResponse.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SubscriptionsResponse.cs new file mode 100644 index 000000000000..1b32cecb9b77 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SubscriptionsResponse.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.Management.Marketplace.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Subscription list operation response. + /// + public partial class SubscriptionsResponse + { + /// + /// Initializes a new instance of the SubscriptionsResponse class. + /// + public SubscriptionsResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubscriptionsResponse class. + /// + /// An array of subscriptions. + /// The skip token to retrieve the next + /// page. + /// Number of subscriptions on the page + public SubscriptionsResponse(IList value = default(IList), string skipToken = default(string), long? count = default(long?)) + { + Value = value; + SkipToken = skipToken; + Count = count; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets an array of subscriptions. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + /// + /// Gets the skip token to retrieve the next page. + /// + [JsonProperty(PropertyName = "skipToken")] + public string SkipToken { get; private set; } + + /// + /// Gets number of subscriptions on the page + /// + [JsonProperty(PropertyName = "count")] + public long? Count { get; private set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreCollectionOfferOperations.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreCollectionOfferOperations.cs index b3a523353014..63e392b537d2 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreCollectionOfferOperations.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreCollectionOfferOperations.cs @@ -86,14 +86,14 @@ internal PrivateStoreCollectionOfferOperations(MarketplaceRPServiceClient client { throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (collectionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "collectionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -279,14 +279,14 @@ internal PrivateStoreCollectionOfferOperations(MarketplaceRPServiceClient client { throw new ValidationException(ValidationRules.CannotBeNull, "offerId"); } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (collectionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "collectionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -476,14 +476,14 @@ internal PrivateStoreCollectionOfferOperations(MarketplaceRPServiceClient client { throw new ValidationException(ValidationRules.CannotBeNull, "offerId"); } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (collectionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "collectionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -675,14 +675,14 @@ internal PrivateStoreCollectionOfferOperations(MarketplaceRPServiceClient client { throw new ValidationException(ValidationRules.CannotBeNull, "offerId"); } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (collectionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "collectionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -853,14 +853,14 @@ internal PrivateStoreCollectionOfferOperations(MarketplaceRPServiceClient client { throw new ValidationException(ValidationRules.CannotBeNull, "offerId"); } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (collectionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "collectionId"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOperations.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOperations.cs index f2cba7daa808..73b746699e81 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOperations.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOperations.cs @@ -1497,8 +1497,8 @@ internal PrivateStoreOperations(MarketplaceRPServiceClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("payload", payload); tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("payload", payload); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BulkCollectionsAction", tracingParameters); } @@ -2249,9 +2249,9 @@ internal PrivateStoreOperations(MarketplaceRPServiceClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("payload", payload); tracingParameters.Add("privateStoreId", privateStoreId); tracingParameters.Add("requestApprovalId", requestApprovalId); + tracingParameters.Add("payload", payload); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "QueryRequestApprovalMethod", tracingParameters); } @@ -2571,15 +2571,15 @@ internal PrivateStoreOperations(MarketplaceRPServiceClient client) /// /// Get open approval requests /// - /// - /// The publisher id of this offer. - /// /// /// The store ID - must use the tenant ID /// /// /// The admin request approval ID to get create or update /// + /// + /// The publisher id of this offer. + /// /// /// Headers that will be added to request. /// @@ -2601,12 +2601,8 @@ internal PrivateStoreOperations(MarketplaceRPServiceClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetAdminRequestApprovalWithHttpMessagesAsync(string publisherId, string privateStoreId, string adminRequestApprovalId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetAdminRequestApprovalWithHttpMessagesAsync(string privateStoreId, string adminRequestApprovalId, string publisherId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (publisherId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "publisherId"); - } if (privateStoreId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); @@ -2615,6 +2611,10 @@ internal PrivateStoreOperations(MarketplaceRPServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "adminRequestApprovalId"); } + if (publisherId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publisherId"); + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -2626,9 +2626,9 @@ internal PrivateStoreOperations(MarketplaceRPServiceClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("publisherId", publisherId); tracingParameters.Add("privateStoreId", privateStoreId); tracingParameters.Add("adminRequestApprovalId", adminRequestApprovalId); + tracingParameters.Add("publisherId", publisherId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetAdminRequestApproval", tracingParameters); } @@ -2820,9 +2820,9 @@ internal PrivateStoreOperations(MarketplaceRPServiceClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("payload", payload); tracingParameters.Add("privateStoreId", privateStoreId); tracingParameters.Add("adminRequestApprovalId", adminRequestApprovalId); + tracingParameters.Add("payload", payload); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UpdateAdminRequestApproval", tracingParameters); } @@ -3189,9 +3189,9 @@ internal PrivateStoreOperations(MarketplaceRPServiceClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("payload", payload); tracingParameters.Add("privateStoreId", privateStoreId); tracingParameters.Add("offerId", offerId); + tracingParameters.Add("payload", payload); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "AcknowledgeOfferNotification", tracingParameters); } @@ -3363,9 +3363,9 @@ internal PrivateStoreOperations(MarketplaceRPServiceClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("payload", payload); tracingParameters.Add("privateStoreId", privateStoreId); tracingParameters.Add("requestApprovalId", requestApprovalId); + tracingParameters.Add("payload", payload); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "WithdrawPlan", tracingParameters); } @@ -3487,6 +3487,735 @@ internal PrivateStoreOperations(MarketplaceRPServiceClient client) return _result; } + /// + /// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> FetchAllSubscriptionsInTenantWithHttpMessagesAsync(string privateStoreId, string nextPageToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (privateStoreId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("nextPageToken", nextPageToken); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "FetchAllSubscriptionsInTenant", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/fetchAllSubscriptionsInTenant").ToString(); + _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (nextPageToken != null) + { + if (_httpRequest.Headers.Contains("next-page-token")) + { + _httpRequest.Headers.Remove("next-page-token"); + } + _httpRequest.Headers.TryAddWithoutValidation("next-page-token", nextPageToken); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List new plans notifications + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListNewPlansNotificationsWithHttpMessagesAsync(string privateStoreId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (privateStoreId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNewPlansNotifications", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/listNewPlansNotifications").ToString(); + _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List stop sell notifications for both stop sell offers and stop sell plans + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListStopSellOffersPlansNotificationsWithHttpMessagesAsync(string privateStoreId, StopSellSubscriptions stopSellSubscriptions = default(StopSellSubscriptions), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (privateStoreId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("stopSellSubscriptions", stopSellSubscriptions); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListStopSellOffersPlansNotifications", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/listStopSellOffersPlansNotifications").ToString(); + _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(stopSellSubscriptions != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(stopSellSubscriptions, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List all the subscriptions in the private store context + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListSubscriptionsContextWithHttpMessagesAsync(string privateStoreId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (privateStoreId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListSubscriptionsContext", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/listSubscriptionsContext").ToString(); + _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Gets the list of available private stores. /// diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOperationsExtensions.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOperationsExtensions.cs index 4f687bf672d5..bcf803071dc1 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOperationsExtensions.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOperationsExtensions.cs @@ -543,18 +543,18 @@ public static AdminRequestApprovalsList AdminRequestApprovalsListMethod(this IPr /// /// The operations group for this extension method. /// - /// - /// The publisher id of this offer. - /// /// /// The store ID - must use the tenant ID /// /// /// The admin request approval ID to get create or update /// - public static AdminRequestApprovalsResource GetAdminRequestApproval(this IPrivateStoreOperations operations, string publisherId, string privateStoreId, string adminRequestApprovalId) + /// + /// The publisher id of this offer. + /// + public static AdminRequestApprovalsResource GetAdminRequestApproval(this IPrivateStoreOperations operations, string privateStoreId, string adminRequestApprovalId, string publisherId) { - return operations.GetAdminRequestApprovalAsync(publisherId, privateStoreId, adminRequestApprovalId).GetAwaiter().GetResult(); + return operations.GetAdminRequestApprovalAsync(privateStoreId, adminRequestApprovalId, publisherId).GetAwaiter().GetResult(); } /// @@ -563,21 +563,21 @@ public static AdminRequestApprovalsResource GetAdminRequestApproval(this IPrivat /// /// The operations group for this extension method. /// - /// - /// The publisher id of this offer. - /// /// /// The store ID - must use the tenant ID /// /// /// The admin request approval ID to get create or update /// + /// + /// The publisher id of this offer. + /// /// /// The cancellation token. /// - public static async Task GetAdminRequestApprovalAsync(this IPrivateStoreOperations operations, string publisherId, string privateStoreId, string adminRequestApprovalId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAdminRequestApprovalAsync(this IPrivateStoreOperations operations, string privateStoreId, string adminRequestApprovalId, string publisherId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetAdminRequestApprovalWithHttpMessagesAsync(publisherId, privateStoreId, adminRequestApprovalId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetAdminRequestApprovalWithHttpMessagesAsync(privateStoreId, adminRequestApprovalId, publisherId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -745,6 +745,152 @@ public static PrivateStoreNotificationsState QueryNotificationsState(this IPriva (await operations.WithdrawPlanWithHttpMessagesAsync(privateStoreId, requestApprovalId, payload, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Fetch all subscriptions in tenant, only for marketplace admin + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The skip token to get the next page. + /// + public static SubscriptionsResponse FetchAllSubscriptionsInTenant(this IPrivateStoreOperations operations, string privateStoreId, string nextPageToken = default(string)) + { + return operations.FetchAllSubscriptionsInTenantAsync(privateStoreId, nextPageToken).GetAwaiter().GetResult(); + } + + /// + /// Fetch all subscriptions in tenant, only for marketplace admin + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The skip token to get the next page. + /// + /// + /// The cancellation token. + /// + public static async Task FetchAllSubscriptionsInTenantAsync(this IPrivateStoreOperations operations, string privateStoreId, string nextPageToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.FetchAllSubscriptionsInTenantWithHttpMessagesAsync(privateStoreId, nextPageToken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List new plans notifications + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + public static NewPlansNotificationsList ListNewPlansNotifications(this IPrivateStoreOperations operations, string privateStoreId) + { + return operations.ListNewPlansNotificationsAsync(privateStoreId).GetAwaiter().GetResult(); + } + + /// + /// List new plans notifications + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The cancellation token. + /// + public static async Task ListNewPlansNotificationsAsync(this IPrivateStoreOperations operations, string privateStoreId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNewPlansNotificationsWithHttpMessagesAsync(privateStoreId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List stop sell notifications for both stop sell offers and stop sell plans + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// + public static StopSellOffersPlansNotificationsList ListStopSellOffersPlansNotifications(this IPrivateStoreOperations operations, string privateStoreId, StopSellSubscriptions stopSellSubscriptions = default(StopSellSubscriptions)) + { + return operations.ListStopSellOffersPlansNotificationsAsync(privateStoreId, stopSellSubscriptions).GetAwaiter().GetResult(); + } + + /// + /// List stop sell notifications for both stop sell offers and stop sell plans + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task ListStopSellOffersPlansNotificationsAsync(this IPrivateStoreOperations operations, string privateStoreId, StopSellSubscriptions stopSellSubscriptions = default(StopSellSubscriptions), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListStopSellOffersPlansNotificationsWithHttpMessagesAsync(privateStoreId, stopSellSubscriptions, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List all the subscriptions in the private store context + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + public static SubscriptionsContextList ListSubscriptionsContext(this IPrivateStoreOperations operations, string privateStoreId) + { + return operations.ListSubscriptionsContextAsync(privateStoreId).GetAwaiter().GetResult(); + } + + /// + /// List all the subscriptions in the private store context + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The cancellation token. + /// + public static async Task ListSubscriptionsContextAsync(this IPrivateStoreOperations operations, string privateStoreId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListSubscriptionsContextWithHttpMessagesAsync(privateStoreId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets the list of available private stores. /// diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/SdkInfo_MarketplaceRPService.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/SdkInfo_MarketplaceRPService.cs index 90d88f3cc8e2..ab32d48d6505 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/SdkInfo_MarketplaceRPService.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/SdkInfo_MarketplaceRPService.cs @@ -19,23 +19,12 @@ public static IEnumerable> ApiInfo_MarketplaceRPSe { return new Tuple[] { - new Tuple("Marketplace", "Operations", "2021-06-01"), - new Tuple("Marketplace", "PrivateStore", "2021-06-01"), - new Tuple("Marketplace", "PrivateStoreCollection", "2021-06-01"), - new Tuple("Marketplace", "PrivateStoreCollectionOffer", "2021-06-01"), + new Tuple("Marketplace", "Operations", "2021-12-01"), + new Tuple("Marketplace", "PrivateStore", "2021-12-01"), + new Tuple("Marketplace", "PrivateStoreCollection", "2021-12-01"), + new Tuple("Marketplace", "PrivateStoreCollectionOffer", "2021-12-01"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/main/specification/marketplace/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\Users\\ilavi\\repos\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "main"; - public static readonly String GithubCommidId = "417fa30d2449b9aa56dab2b991a4e799a31f8cd4"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } -