diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IMarketplaceManagementClient.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IMarketplaceRPServiceClient.cs similarity index 76% rename from sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IMarketplaceManagementClient.cs rename to sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IMarketplaceRPServiceClient.cs index d1a41e04716d..7ac17a31b183 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IMarketplaceManagementClient.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IMarketplaceRPServiceClient.cs @@ -16,9 +16,9 @@ namespace Microsoft.Azure.Management.Marketplace using Newtonsoft.Json; /// - /// REST APIs for Azure Marketplace + /// REST APIs for Private Marketplace /// - public partial interface IMarketplaceManagementClient : System.IDisposable + public partial interface IMarketplaceRPServiceClient : System.IDisposable { /// /// The base URI of the service. @@ -65,29 +65,19 @@ public partial interface IMarketplaceManagementClient : System.IDisposable /// - /// Gets the IPrivateStoreOffersOperations. - /// - IPrivateStoreOffersOperations PrivateStoreOffers { get; } - - /// - /// Gets the IPrivateStorePrivateOffersOperations. - /// - IPrivateStorePrivateOffersOperations PrivateStorePrivateOffers { get; } - - /// - /// Gets the IPrivateStoreOfferOperations. + /// Gets the IPrivateStoreOperations. /// - IPrivateStoreOfferOperations PrivateStoreOffer { get; } + IPrivateStoreOperations PrivateStore { get; } /// - /// Gets the IPrivateStorePrivateOfferOperations. + /// Gets the IPrivateStoreCollectionOperations. /// - IPrivateStorePrivateOfferOperations PrivateStorePrivateOffer { get; } + IPrivateStoreCollectionOperations PrivateStoreCollection { get; } /// - /// Gets the IPrivateStoreOperations. + /// Gets the IPrivateStoreCollectionOfferOperations. /// - IPrivateStoreOperations PrivateStore { get; } + IPrivateStoreCollectionOfferOperations PrivateStoreCollectionOffer { get; } /// /// Gets the IOperations. diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreOfferOperations.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreCollectionOfferOperations.cs similarity index 54% rename from sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreOfferOperations.cs rename to sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreCollectionOfferOperations.cs index 5586be176f92..9dbb13e0a1c5 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreOfferOperations.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreCollectionOfferOperations.cs @@ -19,18 +19,19 @@ namespace Microsoft.Azure.Management.Marketplace using System.Threading.Tasks; /// - /// PrivateStoreOfferOperations operations. + /// PrivateStoreCollectionOfferOperations operations. /// - public partial interface IPrivateStoreOfferOperations + public partial interface IPrivateStoreCollectionOfferOperations { /// - /// Deletes an offer from the given private store. + /// Get a list of all private offers in the given private store and + /// collection /// /// /// The store ID - must use the tenant ID /// - /// - /// The offer ID to update or delete + /// + /// The collection ID /// /// /// The headers that will be added to request. @@ -41,10 +42,13 @@ public partial interface IPrivateStoreOfferOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string privateStoreId, string offerId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string privateStoreId, string collectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets information about a specific offer. /// @@ -54,6 +58,9 @@ public partial interface IPrivateStoreOfferOperations /// /// The offer ID to update or delete /// + /// + /// The collection ID + /// /// /// The headers that will be added to request. /// @@ -69,9 +76,9 @@ public partial interface IPrivateStoreOfferOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string privateStoreId, string offerId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string privateStoreId, string offerId, string collectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Update or add an offer to the default collection of the private + /// Update or add an offer to a specific collection of the private /// store. /// /// @@ -80,6 +87,9 @@ public partial interface IPrivateStoreOfferOperations /// /// The offer ID to update or delete /// + /// + /// The collection ID + /// /// /// /// @@ -97,7 +107,32 @@ public partial interface IPrivateStoreOfferOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string privateStoreId, string offerId, Offer payload = default(Offer), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string privateStoreId, string offerId, string collectionId, Offer payload = default(Offer), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an offer from the given collection of private store. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The offer ID to update or delete + /// + /// + /// The collection ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string privateStoreId, string offerId, string collectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete Private store offer. This is a workaround. /// @@ -107,8 +142,13 @@ public partial interface IPrivateStoreOfferOperations /// /// The offer ID to update or delete /// + /// + /// The collection ID + /// /// - /// Possible values include: 'DeletePrivateStoreOffer', 'Ping' + /// Possible values include: 'DeletePrivateStoreOffer', + /// 'DeletePrivateStoreCollection', + /// 'DeletePrivateStoreCollectionOffer', 'Ping' /// /// /// The headers that will be added to request. @@ -122,6 +162,29 @@ public partial interface IPrivateStoreOfferOperations /// /// Thrown when a required parameter is null /// - Task PostWithHttpMessagesAsync(string privateStoreId, string offerId, string payload = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task PostWithHttpMessagesAsync(string privateStoreId, string offerId, string collectionId, string payload = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a list of all private offers in the given private store and + /// collection + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreCollectionOperations.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreCollectionOperations.cs new file mode 100644 index 000000000000..6c6368bd3dd6 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreCollectionOperations.cs @@ -0,0 +1,178 @@ +// +// 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateStoreCollectionOperations operations. + /// + public partial interface IPrivateStoreCollectionOperations + { + /// + /// Gets private store collections list + /// + /// + /// 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> ListWithHttpMessagesAsync(string privateStoreId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets private store collection + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection 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> GetWithHttpMessagesAsync(string privateStoreId, string collectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update private store collection + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection 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> CreateOrUpdateWithHttpMessagesAsync(string privateStoreId, string collectionId, Collection payload = default(Collection), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a collection from the given private store. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string privateStoreId, string collectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete Private store collection. This is a workaround. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection ID + /// + /// + /// Possible values include: 'DeletePrivateStoreOffer', + /// 'DeletePrivateStoreCollection', + /// 'DeletePrivateStoreCollectionOffer', 'Ping' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task PostWithHttpMessagesAsync(string privateStoreId, string collectionId, string payload = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// transferring offers (copy or move) from source collection to target + /// collection(s) + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection 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> TransferOffersWithHttpMessagesAsync(string privateStoreId, string collectionId, TransferOffersProperties payload = default(TransferOffersProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreOffersOperations.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreOffersOperations.cs deleted file mode 100644 index be5173c0e64a..000000000000 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreOffersOperations.cs +++ /dev/null @@ -1,71 +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.Management.Marketplace -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateStoreOffersOperations operations. - /// - public partial interface IPrivateStoreOffersOperations - { - /// - /// Get a list of all private offers in the given private store - /// - /// - /// 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>> ListWithHttpMessagesAsync(string privateStoreId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get a list of all private offers in the given private store - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} 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 297e49eb4cfa..50b35833524c 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreOperations.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreOperations.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.Marketplace public partial interface IPrivateStoreOperations { /// - /// Gets the list of available private stores + /// Gets the list of available private stores. /// /// /// Determines if to use cache or DB for serving this request @@ -68,6 +68,27 @@ public partial interface IPrivateStoreOperations /// Task> GetWithHttpMessagesAsync(string privateStoreId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Changes private store properties + /// + /// + /// 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 a required parameter is null + /// + Task CreateOrUpdateWithHttpMessagesAsync(string privateStoreId, PrivateStore payload = default(PrivateStore), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Deletes the private store. All that is not saved will be lost. /// /// @@ -87,7 +108,52 @@ public partial interface IPrivateStoreOperations /// Task DeleteWithHttpMessagesAsync(string privateStoreId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Changes private store properties + /// List of offers, regardless the collections + /// + /// + /// 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> QueryOffersMethodWithHttpMessagesAsync(string privateStoreId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Tenant billing accounts names + /// + /// + /// 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> BillingAccountsWithHttpMessagesAsync(string privateStoreId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 @@ -103,12 +169,313 @@ public partial interface IPrivateStoreOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task CreateOrUpdateWithHttpMessagesAsync(string privateStoreId, PrivateStore payload = default(PrivateStore), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CollectionsToSubscriptionsMappingWithHttpMessagesAsync(string privateStoreId, CollectionsToSubscriptionsMappingPayload payload = default(CollectionsToSubscriptionsMappingPayload), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get map of plans and related approved subscriptions. + /// + /// + /// 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> QueryApprovedPlansMethodWithHttpMessagesAsync(string privateStoreId, QueryApprovedPlansPayload payload = default(QueryApprovedPlansPayload), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Perform an action on bulk collections + /// + /// + /// 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> BulkCollectionsActionWithHttpMessagesAsync(string privateStoreId, BulkCollectionsPayload payload = default(BulkCollectionsPayload), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all open approval requests of current user + /// + /// + /// 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> GetApprovalRequestsListWithHttpMessagesAsync(string privateStoreId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get open request approval details + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The request approval ID to get create or update + /// + /// + /// 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> GetRequestApprovalWithHttpMessagesAsync(string privateStoreId, string requestApprovalId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create approval request + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The request approval ID to get create or update + /// + /// + /// + /// + /// 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> CreateApprovalRequestWithHttpMessagesAsync(string privateStoreId, string requestApprovalId, RequestApprovalResource payload = default(RequestApprovalResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 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> QueryRequestApprovalMethodWithHttpMessagesAsync(string privateStoreId, string requestApprovalId, QueryRequestApprovalProperties payload = default(QueryRequestApprovalProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get list of admin request approvals + /// + /// + /// 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> AdminRequestApprovalsListMethodWithHttpMessagesAsync(string privateStoreId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 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> GetAdminRequestApprovalWithHttpMessagesAsync(string publisherId, string privateStoreId, string adminRequestApprovalId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 + /// + /// + /// + /// + /// 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> UpdateAdminRequestApprovalWithHttpMessagesAsync(string privateStoreId, string adminRequestApprovalId, AdminRequestApprovalsResource payload = default(AdminRequestApprovalsResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get private store notifications state + /// + /// + /// 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> QueryNotificationsStateWithHttpMessagesAsync(string privateStoreId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Acknowledge notification for offer + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The offer ID to update or delete + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task AcknowledgeOfferNotificationWithHttpMessagesAsync(string privateStoreId, string offerId, AcknowledgeOfferNotificationProperties payload = default(AcknowledgeOfferNotificationProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task WithdrawPlanWithHttpMessagesAsync(string privateStoreId, string requestApprovalId, WithdrawProperties payload = default(WithdrawProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets the list of available private stores + /// Gets the list of available private stores. /// /// /// The NextLink from the previous successful call to List operation. diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStorePrivateOfferOperations.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStorePrivateOfferOperations.cs deleted file mode 100644 index 1f9ce71a006a..000000000000 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStorePrivateOfferOperations.cs +++ /dev/null @@ -1,86 +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.Management.Marketplace -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateStorePrivateOfferOperations operations. - /// - public partial interface IPrivateStorePrivateOfferOperations - { - /// - /// Gets information about a specific private offer. - /// - /// - /// Subscription id of the private offers - /// - /// - /// The store ID - must use the tenant ID - /// - /// - /// The offer ID to update or delete - /// - /// - /// 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> GetWithHttpMessagesAsync(string subscriptionId, string privateStoreId, string offerId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Update or add a private offer to the default collection of the - /// private store. - /// - /// - /// Subscription id of the private offers - /// - /// - /// The store ID - must use the tenant ID - /// - /// - /// The offer ID to update or delete - /// - /// - /// - /// - /// 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> CreateOrUpdateWithHttpMessagesAsync(string subscriptionId, string privateStoreId, string offerId, Offer payload = default(Offer), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStorePrivateOffersOperations.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStorePrivateOffersOperations.cs deleted file mode 100644 index 7c43f9cf2284..000000000000 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStorePrivateOffersOperations.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.Management.Marketplace -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateStorePrivateOffersOperations operations. - /// - public partial interface IPrivateStorePrivateOffersOperations - { - /// - /// Get a list of all private offers in the given private store - /// - /// - /// Subscription id of the private offers - /// - /// - /// 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>> ListWithHttpMessagesAsync(string subscriptionId, string privateStoreId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get a list of all private offers in the given private store - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/MarketplaceManagementClient.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/MarketplaceRPServiceClient.cs similarity index 76% rename from sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/MarketplaceManagementClient.cs rename to sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/MarketplaceRPServiceClient.cs index 152f7cbbcb28..2fdb2bd09bbc 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/MarketplaceManagementClient.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/MarketplaceRPServiceClient.cs @@ -22,9 +22,9 @@ namespace Microsoft.Azure.Management.Marketplace using System.Net.Http; /// - /// REST APIs for Azure Marketplace + /// REST APIs for Private Marketplace /// - public partial class MarketplaceManagementClient : ServiceClient, IMarketplaceManagementClient, IAzureClient + public partial class MarketplaceRPServiceClient : ServiceClient, IMarketplaceRPServiceClient, IAzureClient { /// /// The base URI of the service. @@ -70,29 +70,19 @@ public partial class MarketplaceManagementClient : ServiceClient - /// Gets the IPrivateStoreOffersOperations. - /// - public virtual IPrivateStoreOffersOperations PrivateStoreOffers { get; private set; } - - /// - /// Gets the IPrivateStorePrivateOffersOperations. - /// - public virtual IPrivateStorePrivateOffersOperations PrivateStorePrivateOffers { get; private set; } - - /// - /// Gets the IPrivateStoreOfferOperations. + /// Gets the IPrivateStoreOperations. /// - public virtual IPrivateStoreOfferOperations PrivateStoreOffer { get; private set; } + public virtual IPrivateStoreOperations PrivateStore { get; private set; } /// - /// Gets the IPrivateStorePrivateOfferOperations. + /// Gets the IPrivateStoreCollectionOperations. /// - public virtual IPrivateStorePrivateOfferOperations PrivateStorePrivateOffer { get; private set; } + public virtual IPrivateStoreCollectionOperations PrivateStoreCollection { get; private set; } /// - /// Gets the IPrivateStoreOperations. + /// Gets the IPrivateStoreCollectionOfferOperations. /// - public virtual IPrivateStoreOperations PrivateStore { get; private set; } + public virtual IPrivateStoreCollectionOfferOperations PrivateStoreCollectionOffer { get; private set; } /// /// Gets the IOperations. @@ -100,31 +90,31 @@ public partial class MarketplaceManagementClient : ServiceClient - /// Initializes a new instance of the MarketplaceManagementClient class. + /// Initializes a new instance of the MarketplaceRPServiceClient class. /// /// /// HttpClient to be used /// /// - /// True: will dispose the provided httpClient on calling MarketplaceManagementClient.Dispose(). False: will not dispose provided httpClient - protected MarketplaceManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + /// True: will dispose the provided httpClient on calling MarketplaceRPServiceClient.Dispose(). False: will not dispose provided httpClient + protected MarketplaceRPServiceClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) { Initialize(); } /// - /// Initializes a new instance of the MarketplaceManagementClient class. + /// Initializes a new instance of the MarketplaceRPServiceClient class. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected MarketplaceManagementClient(params DelegatingHandler[] handlers) : base(handlers) + protected MarketplaceRPServiceClient(params DelegatingHandler[] handlers) : base(handlers) { Initialize(); } /// - /// Initializes a new instance of the MarketplaceManagementClient class. + /// Initializes a new instance of the MarketplaceRPServiceClient class. /// /// /// Optional. The http client handler used to handle http transport. @@ -132,13 +122,13 @@ protected MarketplaceManagementClient(params DelegatingHandler[] handlers) : bas /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected MarketplaceManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + protected MarketplaceRPServiceClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { Initialize(); } /// - /// Initializes a new instance of the MarketplaceManagementClient class. + /// Initializes a new instance of the MarketplaceRPServiceClient class. /// /// /// Optional. The base URI of the service. @@ -149,7 +139,7 @@ protected MarketplaceManagementClient(HttpClientHandler rootHandler, params Dele /// /// Thrown when a required parameter is null /// - protected MarketplaceManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + protected MarketplaceRPServiceClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -159,7 +149,7 @@ protected MarketplaceManagementClient(System.Uri baseUri, params DelegatingHandl } /// - /// Initializes a new instance of the MarketplaceManagementClient class. + /// Initializes a new instance of the MarketplaceRPServiceClient class. /// /// /// Optional. The base URI of the service. @@ -173,7 +163,7 @@ protected MarketplaceManagementClient(System.Uri baseUri, params DelegatingHandl /// /// Thrown when a required parameter is null /// - protected MarketplaceManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + protected MarketplaceRPServiceClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -183,7 +173,7 @@ protected MarketplaceManagementClient(System.Uri baseUri, HttpClientHandler root } /// - /// Initializes a new instance of the MarketplaceManagementClient class. + /// Initializes a new instance of the MarketplaceRPServiceClient class. /// /// /// Required. Credentials needed for the client to connect to Azure. @@ -194,7 +184,7 @@ protected MarketplaceManagementClient(System.Uri baseUri, HttpClientHandler root /// /// Thrown when a required parameter is null /// - public MarketplaceManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + public MarketplaceRPServiceClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (credentials == null) { @@ -208,7 +198,7 @@ public MarketplaceManagementClient(ServiceClientCredentials credentials, params } /// - /// Initializes a new instance of the MarketplaceManagementClient class. + /// Initializes a new instance of the MarketplaceRPServiceClient class. /// /// /// Required. Credentials needed for the client to connect to Azure. @@ -217,11 +207,11 @@ public MarketplaceManagementClient(ServiceClientCredentials credentials, params /// HttpClient to be used /// /// - /// True: will dispose the provided httpClient on calling MarketplaceManagementClient.Dispose(). False: will not dispose provided httpClient + /// True: will dispose the provided httpClient on calling MarketplaceRPServiceClient.Dispose(). False: will not dispose provided httpClient /// /// Thrown when a required parameter is null /// - public MarketplaceManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + public MarketplaceRPServiceClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) { if (credentials == null) { @@ -235,7 +225,7 @@ public MarketplaceManagementClient(ServiceClientCredentials credentials, HttpCli } /// - /// Initializes a new instance of the MarketplaceManagementClient class. + /// Initializes a new instance of the MarketplaceRPServiceClient class. /// /// /// Required. Credentials needed for the client to connect to Azure. @@ -249,7 +239,7 @@ public MarketplaceManagementClient(ServiceClientCredentials credentials, HttpCli /// /// Thrown when a required parameter is null /// - public MarketplaceManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + public MarketplaceRPServiceClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (credentials == null) { @@ -263,7 +253,7 @@ public MarketplaceManagementClient(ServiceClientCredentials credentials, HttpCli } /// - /// Initializes a new instance of the MarketplaceManagementClient class. + /// Initializes a new instance of the MarketplaceRPServiceClient class. /// /// /// Optional. The base URI of the service. @@ -277,7 +267,7 @@ public MarketplaceManagementClient(ServiceClientCredentials credentials, HttpCli /// /// Thrown when a required parameter is null /// - public MarketplaceManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + public MarketplaceRPServiceClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -296,7 +286,7 @@ public MarketplaceManagementClient(System.Uri baseUri, ServiceClientCredentials } /// - /// Initializes a new instance of the MarketplaceManagementClient class. + /// Initializes a new instance of the MarketplaceRPServiceClient class. /// /// /// Optional. The base URI of the service. @@ -313,7 +303,7 @@ public MarketplaceManagementClient(System.Uri baseUri, ServiceClientCredentials /// /// Thrown when a required parameter is null /// - public MarketplaceManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + public MarketplaceRPServiceClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -340,14 +330,12 @@ public MarketplaceManagementClient(System.Uri baseUri, ServiceClientCredentials /// private void Initialize() { - PrivateStoreOffers = new PrivateStoreOffersOperations(this); - PrivateStorePrivateOffers = new PrivateStorePrivateOffersOperations(this); - PrivateStoreOffer = new PrivateStoreOfferOperations(this); - PrivateStorePrivateOffer = new PrivateStorePrivateOfferOperations(this); PrivateStore = new PrivateStoreOperations(this); + PrivateStoreCollection = new PrivateStoreCollectionOperations(this); + PrivateStoreCollectionOffer = new PrivateStoreCollectionOfferOperations(this); Operations = new Operations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2020-01-01"; + ApiVersion = "2021-06-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/AcknowledgeOfferNotificationProperties.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/AcknowledgeOfferNotificationProperties.cs new file mode 100644 index 000000000000..074622562630 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/AcknowledgeOfferNotificationProperties.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.Management.Marketplace.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Notification update request payload + /// + [Rest.Serialization.JsonTransformation] + public partial class AcknowledgeOfferNotificationProperties + { + /// + /// Initializes a new instance of the + /// AcknowledgeOfferNotificationProperties class. + /// + public AcknowledgeOfferNotificationProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AcknowledgeOfferNotificationProperties class. + /// + /// Gets or sets a value indicating whether + /// acknowledge action flag is enabled + /// Gets or sets a value indicating whether + /// dismiss action flag is enabled + /// Gets or sets a value indicating whether + /// remove offer action flag is enabled + /// Gets or sets added plans + /// Gets or sets remove plans + public AcknowledgeOfferNotificationProperties(bool? acknowledge = default(bool?), bool? dismiss = default(bool?), bool? removeOffer = default(bool?), IList addPlans = default(IList), IList removePlans = default(IList)) + { + Acknowledge = acknowledge; + Dismiss = dismiss; + RemoveOffer = removeOffer; + AddPlans = addPlans; + RemovePlans = removePlans; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a value indicating whether acknowledge action flag is + /// enabled + /// + [JsonProperty(PropertyName = "properties.acknowledge")] + public bool? Acknowledge { get; set; } + + /// + /// Gets or sets a value indicating whether dismiss action flag is + /// enabled + /// + [JsonProperty(PropertyName = "properties.dismiss")] + public bool? Dismiss { get; set; } + + /// + /// Gets or sets a value indicating whether remove offer action flag is + /// enabled + /// + [JsonProperty(PropertyName = "properties.removeOffer")] + public bool? RemoveOffer { get; set; } + + /// + /// Gets or sets added plans + /// + [JsonProperty(PropertyName = "properties.addPlans")] + public IList AddPlans { get; set; } + + /// + /// Gets or sets remove plans + /// + [JsonProperty(PropertyName = "properties.removePlans")] + public IList RemovePlans { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/AdminAction.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/AdminAction.cs new file mode 100644 index 000000000000..5470c053990a --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/AdminAction.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. +// +// Code 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 AdminAction. + /// + public static class AdminAction + { + public const string Approved = "Approved"; + public const string Rejected = "Rejected"; + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/AdminRequestApprovalsList.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/AdminRequestApprovalsList.cs new file mode 100644 index 000000000000..ea1026aca0ac --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/AdminRequestApprovalsList.cs @@ -0,0 +1,61 @@ +// +// 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 admin request approval resources + /// + public partial class AdminRequestApprovalsList + { + /// + /// Initializes a new instance of the AdminRequestApprovalsList class. + /// + public AdminRequestApprovalsList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AdminRequestApprovalsList class. + /// + /// URL to get the next set of notifications + /// list results if there are any. + public AdminRequestApprovalsList(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Gets URL to get the next set of notifications list results if there + /// are any. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/AdminRequestApprovalsResource.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/AdminRequestApprovalsResource.cs new file mode 100644 index 000000000000..01a668d19bdc --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/AdminRequestApprovalsResource.cs @@ -0,0 +1,133 @@ +// +// 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 Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Admin request approval resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class AdminRequestApprovalsResource : Resource + { + /// + /// Initializes a new instance of the AdminRequestApprovalsResource + /// class. + /// + public AdminRequestApprovalsResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AdminRequestApprovalsResource + /// class. + /// + /// The resource ID. + /// The name of the resource. + /// The type of the resource. + /// Metadata pertaining to creation and last + /// modification of the resource + /// Gets or sets offer Id + /// Gets display name + /// Gets or sets publisher Id + /// Gets or sets admin action. Possible + /// values include: 'Approved', 'Rejected' + /// Gets or sets Approved plans ids, empty + /// in case of rejected + /// Gets or sets admin comment + /// Gets or sets admin details + /// Gets list of plans with requesters + /// details + /// Gets or sets list of associated + /// collection ids + public AdminRequestApprovalsResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string offerId = default(string), string displayName = default(string), string publisherId = default(string), string adminAction = default(string), IList approvedPlans = default(IList), string comment = default(string), string administrator = default(string), IList plans = default(IList), IList collectionIds = default(IList)) + : base(id, name, type, systemData) + { + OfferId = offerId; + DisplayName = displayName; + PublisherId = publisherId; + AdminAction = adminAction; + ApprovedPlans = approvedPlans; + Comment = comment; + Administrator = administrator; + Plans = plans; + CollectionIds = collectionIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets offer Id + /// + [JsonProperty(PropertyName = "properties.offerId")] + public string OfferId { get; set; } + + /// + /// Gets display name + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets or sets publisher Id + /// + [JsonProperty(PropertyName = "properties.publisherId")] + public string PublisherId { get; set; } + + /// + /// Gets or sets admin action. Possible values include: 'Approved', + /// 'Rejected' + /// + [JsonProperty(PropertyName = "properties.adminAction")] + public string AdminAction { get; set; } + + /// + /// Gets or sets Approved plans ids, empty in case of rejected + /// + [JsonProperty(PropertyName = "properties.approvedPlans")] + public IList ApprovedPlans { get; set; } + + /// + /// Gets or sets admin comment + /// + [JsonProperty(PropertyName = "properties.comment")] + public string Comment { get; set; } + + /// + /// Gets or sets admin details + /// + [JsonProperty(PropertyName = "properties.administrator")] + public string Administrator { get; set; } + + /// + /// Gets list of plans with requesters details + /// + [JsonProperty(PropertyName = "properties.plans")] + public IList Plans { get; private set; } + + /// + /// Gets or sets list of associated collection ids + /// + [JsonProperty(PropertyName = "properties.collectionIds")] + public IList CollectionIds { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/BillingAccountsResponse.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/BillingAccountsResponse.cs new file mode 100644 index 000000000000..e512f40ead90 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/BillingAccountsResponse.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; + + /// + /// Billing accounts response object + /// + public partial class BillingAccountsResponse + { + /// + /// Initializes a new instance of the BillingAccountsResponse class. + /// + public BillingAccountsResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingAccountsResponse class. + /// + /// Billing accounts list + public BillingAccountsResponse(IList billingAccounts = default(IList)) + { + BillingAccounts = billingAccounts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets billing accounts list + /// + [JsonProperty(PropertyName = "billingAccounts")] + public IList BillingAccounts { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/BulkCollectionsPayload.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/BulkCollectionsPayload.cs new file mode 100644 index 000000000000..aeddc2423b4b --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/BulkCollectionsPayload.cs @@ -0,0 +1,67 @@ +// +// 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 Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Bulk collections action properties + /// + [Rest.Serialization.JsonTransformation] + public partial class BulkCollectionsPayload + { + /// + /// Initializes a new instance of the BulkCollectionsPayload class. + /// + public BulkCollectionsPayload() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BulkCollectionsPayload class. + /// + /// collection ids list that the action is + /// performed on + /// Action to perform (For example: + /// EnableCollections, DisableCollections) + public BulkCollectionsPayload(IList collectionIds = default(IList), string action = default(string)) + { + CollectionIds = collectionIds; + Action = action; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets collection ids list that the action is performed on + /// + [JsonProperty(PropertyName = "properties.collectionIds")] + public IList CollectionIds { get; set; } + + /// + /// Gets or sets action to perform (For example: EnableCollections, + /// DisableCollections) + /// + [JsonProperty(PropertyName = "properties.action")] + public string Action { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/BulkCollectionsResponse.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/BulkCollectionsResponse.cs new file mode 100644 index 000000000000..286646b2f843 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/BulkCollectionsResponse.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.Management.Marketplace.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The bulk collections response. The response contains two lists that + /// indicate for each collection whether the operation succeeded or failed + /// + public partial class BulkCollectionsResponse + { + /// + /// Initializes a new instance of the BulkCollectionsResponse class. + /// + public BulkCollectionsResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BulkCollectionsResponse class. + /// + /// Succeeded collections + /// Failed collections + public BulkCollectionsResponse(IList succeeded = default(IList), IList failed = default(IList)) + { + Succeeded = succeeded; + Failed = failed; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets succeeded collections + /// + [JsonProperty(PropertyName = "succeeded")] + public IList Succeeded { get; set; } + + /// + /// Gets or sets failed collections + /// + [JsonProperty(PropertyName = "failed")] + public IList Failed { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Collection.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Collection.cs new file mode 100644 index 000000000000..c7a6430d2879 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Collection.cs @@ -0,0 +1,122 @@ +// +// 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 Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Collection data structure. + /// + [Rest.Serialization.JsonTransformation] + public partial class Collection : Resource + { + /// + /// Initializes a new instance of the Collection class. + /// + public Collection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Collection class. + /// + /// The resource ID. + /// The name of the resource. + /// The type of the resource. + /// Metadata pertaining to creation and last + /// modification of the resource + /// Gets collection Id. + /// Gets or sets collection name. + /// Gets or sets the association with Commercial's + /// Billing Account. + /// Indicating whether all subscriptions + /// are selected (=true) or not (=false). + /// 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 + /// Indicating whether the collection is enabled + /// or disabled. + /// Gets the number of offers associated + /// with the collection. + public Collection(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string collectionId = default(string), string collectionName = default(string), string claim = default(string), bool? allSubscriptions = default(bool?), IList subscriptionsList = default(IList), bool? enabled = default(bool?), long? numberOfOffers = default(long?)) + : base(id, name, type, systemData) + { + CollectionId = collectionId; + CollectionName = collectionName; + Claim = claim; + AllSubscriptions = allSubscriptions; + SubscriptionsList = subscriptionsList; + Enabled = enabled; + NumberOfOffers = numberOfOffers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets collection Id. + /// + [JsonProperty(PropertyName = "properties.collectionId")] + public string CollectionId { get; private set; } + + /// + /// Gets or sets collection name. + /// + [JsonProperty(PropertyName = "properties.collectionName")] + public string CollectionName { get; set; } + + /// + /// Gets or sets the association with Commercial's Billing Account. + /// + [JsonProperty(PropertyName = "properties.claim")] + public string Claim { get; set; } + + /// + /// Gets or sets indicating whether all subscriptions are selected + /// (=true) or not (=false). + /// + [JsonProperty(PropertyName = "properties.allSubscriptions")] + public bool? AllSubscriptions { 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 + /// + [JsonProperty(PropertyName = "properties.subscriptionsList")] + public IList SubscriptionsList { get; set; } + + /// + /// Gets or sets indicating whether the collection is enabled or + /// disabled. + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets the number of offers associated with the collection. + /// + [JsonProperty(PropertyName = "properties.numberOfOffers")] + public long? NumberOfOffers { get; private set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/CollectionsDetails.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/CollectionsDetails.cs new file mode 100644 index 000000000000..193bf05e9aa6 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/CollectionsDetails.cs @@ -0,0 +1,59 @@ +// +// 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; + + /// + /// Collection name and id. + /// + public partial class CollectionsDetails + { + /// + /// Initializes a new instance of the CollectionsDetails class. + /// + public CollectionsDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CollectionsDetails class. + /// + /// Collection name. + /// Collection id. + public CollectionsDetails(string collectionName = default(string), string collectionId = default(string)) + { + CollectionName = collectionName; + CollectionId = collectionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets collection name. + /// + [JsonProperty(PropertyName = "collectionName")] + public string CollectionName { get; set; } + + /// + /// Gets or sets collection id. + /// + [JsonProperty(PropertyName = "collectionId")] + public string CollectionId { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Icon.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/CollectionsList.cs similarity index 51% rename from sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Icon.cs rename to sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/CollectionsList.cs index 37d12c3f5855..053cb82e381e 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Icon.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/CollectionsList.cs @@ -11,28 +11,29 @@ namespace Microsoft.Azure.Management.Marketplace.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; - public partial class Icon + public partial class CollectionsList { /// - /// Initializes a new instance of the Icon class. + /// Initializes a new instance of the CollectionsList class. /// - public Icon() + public CollectionsList() { CustomInit(); } /// - /// Initializes a new instance of the Icon class. + /// Initializes a new instance of the CollectionsList class. /// - /// Icon size. Possible values include: 'Small', - /// 'Medium', 'Large', 'Wide', 'Hero' - /// Icon uri - public Icon(string iconKind = default(string), string uri = default(string)) + /// URL to get the next set of offer list + /// results if there are any. + public CollectionsList(IList value = default(IList), string nextLink = default(string)) { - IconKind = iconKind; - Uri = uri; + Value = value; + NextLink = nextLink; CustomInit(); } @@ -42,17 +43,16 @@ public Icon() partial void CustomInit(); /// - /// Gets or sets icon size. Possible values include: 'Small', 'Medium', - /// 'Large', 'Wide', 'Hero' /// - [JsonProperty(PropertyName = "iconKind")] - public string IconKind { get; set; } + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } /// - /// Gets or sets icon uri + /// Gets or sets URL to get the next set of offer list results if there + /// are any. /// - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } } } diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/CollectionsSubscriptionsMappingDetails.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/CollectionsSubscriptionsMappingDetails.cs new file mode 100644 index 000000000000..9f6b9e4ed6a7 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/CollectionsSubscriptionsMappingDetails.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.Management.Marketplace.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Collection name and related subscriptions list + /// + public partial class CollectionsSubscriptionsMappingDetails + { + /// + /// Initializes a new instance of the + /// CollectionsSubscriptionsMappingDetails class. + /// + public CollectionsSubscriptionsMappingDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CollectionsSubscriptionsMappingDetails class. + /// + /// Collection name + /// Subscriptions ids list + public CollectionsSubscriptionsMappingDetails(string collectionName = default(string), IList subscriptions = default(IList)) + { + CollectionName = collectionName; + Subscriptions = subscriptions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets collection name + /// + [JsonProperty(PropertyName = "collectionName")] + public string CollectionName { get; set; } + + /// + /// Gets or sets subscriptions ids list + /// + [JsonProperty(PropertyName = "subscriptions")] + public IList Subscriptions { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/CollectionsToSubscriptionsMappingPayload.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/CollectionsToSubscriptionsMappingPayload.cs new file mode 100644 index 000000000000..b135eaedd18d --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/CollectionsToSubscriptionsMappingPayload.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.Linq; + + /// + /// The subscriptions list to get the related collections + /// + public partial class CollectionsToSubscriptionsMappingPayload + { + /// + /// Initializes a new instance of the + /// CollectionsToSubscriptionsMappingPayload class. + /// + public CollectionsToSubscriptionsMappingPayload() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CollectionsToSubscriptionsMappingPayload class. + /// + /// Subscriptions ids list + public CollectionsToSubscriptionsMappingPayload(CollectionsToSubscriptionsMappingProperties properties = default(CollectionsToSubscriptionsMappingProperties)) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets subscriptions ids list + /// + [JsonProperty(PropertyName = "properties")] + public CollectionsToSubscriptionsMappingProperties Properties { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/CollectionsToSubscriptionsMappingProperties.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/CollectionsToSubscriptionsMappingProperties.cs new file mode 100644 index 000000000000..3dbf61fb2b2a --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/CollectionsToSubscriptionsMappingProperties.cs @@ -0,0 +1,55 @@ +// +// 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; + + /// + /// The subscriptions list to get the related collections + /// + public partial class CollectionsToSubscriptionsMappingProperties + { + /// + /// Initializes a new instance of the + /// CollectionsToSubscriptionsMappingProperties class. + /// + public CollectionsToSubscriptionsMappingProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CollectionsToSubscriptionsMappingProperties class. + /// + /// Subscriptions ids list + public CollectionsToSubscriptionsMappingProperties(IList subscriptionIds = default(IList)) + { + SubscriptionIds = subscriptionIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets subscriptions ids list + /// + [JsonProperty(PropertyName = "subscriptionIds")] + public IList SubscriptionIds { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/CollectionsToSubscriptionsMappingResponse.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/CollectionsToSubscriptionsMappingResponse.cs new file mode 100644 index 000000000000..ded7fff3d3f8 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/CollectionsToSubscriptionsMappingResponse.cs @@ -0,0 +1,55 @@ +// +// 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; + + /// + /// A map of collections subscriptions details + /// + public partial class CollectionsToSubscriptionsMappingResponse + { + /// + /// Initializes a new instance of the + /// CollectionsToSubscriptionsMappingResponse class. + /// + public CollectionsToSubscriptionsMappingResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CollectionsToSubscriptionsMappingResponse class. + /// + /// The map of collections subscriptions + public CollectionsToSubscriptionsMappingResponse(IDictionary details = default(IDictionary)) + { + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the map of collections subscriptions + /// + [JsonProperty(PropertyName = "details")] + public IDictionary Details { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/IdentityType.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/IdentityType.cs new file mode 100644 index 000000000000..49b430f582dc --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/IdentityType.cs @@ -0,0 +1,24 @@ +// +// 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 IdentityType. + /// + public static class IdentityType + { + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/NewNotifications.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/NewNotifications.cs new file mode 100644 index 000000000000..643dddc8dbad --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/NewNotifications.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.Management.Marketplace.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// New plans notification details + /// + public partial class NewNotifications + { + /// + /// Initializes a new instance of the NewNotifications class. + /// + public NewNotifications() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NewNotifications class. + /// + /// Gets offer id + /// Gets offer display name + /// Gets a value indicating whether + /// future plans is enabled. + /// Gets or sets the notification message + /// id + /// Gets or sets the icon url + /// Gets or sets removed plans + /// notifications + public NewNotifications(string offerId = default(string), string displayName = default(string), bool? isFuturePlansEnabled = default(bool?), long? messageCode = default(long?), string icon = default(string), IList plans = default(IList)) + { + OfferId = offerId; + DisplayName = displayName; + IsFuturePlansEnabled = isFuturePlansEnabled; + MessageCode = messageCode; + Icon = icon; + Plans = plans; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets offer id + /// + [JsonProperty(PropertyName = "offerId")] + public string OfferId { get; set; } + + /// + /// Gets offer display name + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets a value indicating whether future plans is enabled. + /// + [JsonProperty(PropertyName = "isFuturePlansEnabled")] + public bool? IsFuturePlansEnabled { get; set; } + + /// + /// Gets or sets the notification message id + /// + [JsonProperty(PropertyName = "messageCode")] + public long? MessageCode { get; set; } + + /// + /// Gets or sets the icon url + /// + [JsonProperty(PropertyName = "icon")] + public string Icon { get; set; } + + /// + /// Gets or sets removed plans notifications + /// + [JsonProperty(PropertyName = "plans")] + public IList Plans { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Offer.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Offer.cs index 6666b7181cae..a07f56d03e40 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Offer.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Offer.cs @@ -37,6 +37,8 @@ public Offer() /// The resource ID. /// The name of the resource. /// The type of the resource. + /// Metadata pertaining to creation and last + /// modification of the resource /// Offers unique id /// It will be displayed prominently in /// the marketplace @@ -56,8 +58,8 @@ public Offer() /// updated. /// Icon File Uris /// Offer plans - public Offer(string id = default(string), string name = default(string), string type = default(string), string uniqueOfferId = default(string), string offerDisplayName = default(string), string publisherDisplayName = default(string), string eTag = default(string), string privateStoreId = default(string), string createdAt = default(string), string modifiedAt = default(string), IList specificPlanIdsLimitation = default(IList), bool? updateSuppressedDueIdempotence = default(bool?), IDictionary iconFileUris = default(IDictionary), IList plans = default(IList)) - : base(id, name, type) + public Offer(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string uniqueOfferId = default(string), string offerDisplayName = default(string), string publisherDisplayName = default(string), string eTag = default(string), string privateStoreId = default(string), string createdAt = default(string), string modifiedAt = default(string), IList specificPlanIdsLimitation = default(IList), bool? updateSuppressedDueIdempotence = default(bool?), IDictionary iconFileUris = default(IDictionary), IList plans = default(IList)) + : base(id, name, type, systemData) { UniqueOfferId = uniqueOfferId; OfferDisplayName = offerDisplayName; @@ -146,5 +148,6 @@ public Offer() /// [JsonProperty(PropertyName = "properties.plans")] public IList Plans { get; set; } + } } diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/OfferProperties.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/OfferProperties.cs new file mode 100644 index 000000000000..5a1d8425db96 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/OfferProperties.cs @@ -0,0 +1,141 @@ +// +// 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; + + public partial class OfferProperties + { + /// + /// Initializes a new instance of the OfferProperties class. + /// + public OfferProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OfferProperties class. + /// + /// Offers unique id + /// It will be displayed prominently in + /// the marketplace + /// Publisher name that will be + /// displayed prominently in the marketplace + /// Identifier for purposes of race + /// condition + /// Private store unique id + /// Private store offer creation date + /// Private store offer modification + /// date + /// Plan ids limitation for + /// this offer + /// 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. + /// Icon File Uris + /// Offer plans + public OfferProperties(string uniqueOfferId = default(string), string offerDisplayName = default(string), string publisherDisplayName = default(string), string eTag = default(string), string privateStoreId = default(string), string createdAt = default(string), string modifiedAt = default(string), IList specificPlanIdsLimitation = default(IList), bool? updateSuppressedDueIdempotence = default(bool?), IDictionary iconFileUris = default(IDictionary), IList plans = default(IList)) + { + UniqueOfferId = uniqueOfferId; + OfferDisplayName = offerDisplayName; + PublisherDisplayName = publisherDisplayName; + ETag = eTag; + PrivateStoreId = privateStoreId; + CreatedAt = createdAt; + ModifiedAt = modifiedAt; + SpecificPlanIdsLimitation = specificPlanIdsLimitation; + UpdateSuppressedDueIdempotence = updateSuppressedDueIdempotence; + IconFileUris = iconFileUris; + Plans = plans; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets offers unique id + /// + [JsonProperty(PropertyName = "uniqueOfferId")] + public string UniqueOfferId { get; private set; } + + /// + /// Gets it will be displayed prominently in the marketplace + /// + [JsonProperty(PropertyName = "offerDisplayName")] + public string OfferDisplayName { get; private set; } + + /// + /// Gets publisher name that will be displayed prominently in the + /// marketplace + /// + [JsonProperty(PropertyName = "publisherDisplayName")] + public string PublisherDisplayName { get; private set; } + + /// + /// Gets or sets identifier for purposes of race condition + /// + [JsonProperty(PropertyName = "eTag")] + public string ETag { get; set; } + + /// + /// Gets private store unique id + /// + [JsonProperty(PropertyName = "privateStoreId")] + public string PrivateStoreId { get; private set; } + + /// + /// Gets private store offer creation date + /// + [JsonProperty(PropertyName = "createdAt")] + public string CreatedAt { get; private set; } + + /// + /// Gets private store offer modification date + /// + [JsonProperty(PropertyName = "modifiedAt")] + public string ModifiedAt { get; private set; } + + /// + /// Gets or sets plan ids limitation for this offer + /// + [JsonProperty(PropertyName = "specificPlanIdsLimitation")] + public IList SpecificPlanIdsLimitation { get; set; } + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "updateSuppressedDueIdempotence")] + public bool? UpdateSuppressedDueIdempotence { get; set; } + + /// + /// Gets or sets icon File Uris + /// + [JsonProperty(PropertyName = "iconFileUris")] + public IDictionary IconFileUris { get; set; } + + /// + /// Gets or sets offer plans + /// + [JsonProperty(PropertyName = "plans")] + public IList Plans { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Operation.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Operation.cs index dc14d9014852..25e0ae6accef 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Operation.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Operation.cs @@ -17,6 +17,8 @@ namespace Microsoft.Azure.Management.Marketplace.Models public static class Operation { public const string DeletePrivateStoreOffer = "DeletePrivateStoreOffer"; + public const string DeletePrivateStoreCollection = "DeletePrivateStoreCollection"; + public const string DeletePrivateStoreCollectionOffer = "DeletePrivateStoreCollectionOffer"; public const string Ping = "Ping"; } } diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/OperationListResult.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/OperationListResult.cs index 264924914ef2..c75952ffe404 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/OperationListResult.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/OperationListResult.cs @@ -36,7 +36,7 @@ public OperationListResult() /// supported by the Microsoft.Marketplace resource provider. /// URL to get the next set of operation list /// results if there are any. - public OperationListResult(IList value = default(IList), string nextLink = default(string)) + public OperationListResult(IList value = default(IList), string nextLink = default(string)) { Value = value; NextLink = nextLink; @@ -53,7 +53,7 @@ public OperationListResult() /// the Microsoft.Marketplace resource provider. /// [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } + public IList Value { get; set; } /// /// Gets URL to get the next set of operation list results if there are diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/PlanDetails.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/PlanDetails.cs new file mode 100644 index 000000000000..e28fd2f31cd4 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/PlanDetails.cs @@ -0,0 +1,98 @@ +// +// 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; + + /// + /// Return plan with request details + /// + public partial class PlanDetails + { + /// + /// Initializes a new instance of the PlanDetails class. + /// + public PlanDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PlanDetails class. + /// + /// Gets or sets Plan Id + /// Gets the plan status. Possible values include: + /// 'Pending', 'Rejected', 'Approved', 'None' + /// Gets request date + /// Gets or sets user's justification for + /// the plan's request + /// Gets or sets the subscription id that + /// the user is requesting to add the plan to + /// Gets or sets the subscription name + /// that the user is requesting to add the plan to + public PlanDetails(string planId = default(string), string status = default(string), object requestDate = default(object), string justification = default(string), string subscriptionId = default(string), string subscriptionName = default(string)) + { + PlanId = planId; + Status = status; + RequestDate = requestDate; + Justification = justification; + SubscriptionId = subscriptionId; + SubscriptionName = subscriptionName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets Plan Id + /// + [JsonProperty(PropertyName = "planId")] + public string PlanId { get; set; } + + /// + /// Gets the plan status. Possible values include: 'Pending', + /// 'Rejected', 'Approved', 'None' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets request date + /// + [JsonProperty(PropertyName = "requestDate")] + public object RequestDate { get; private set; } + + /// + /// Gets or sets user's justification for the plan's request + /// + [JsonProperty(PropertyName = "justification")] + public string Justification { get; set; } + + /// + /// Gets or sets the subscription id that the user is requesting to add + /// the plan to + /// + [JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId { get; set; } + + /// + /// Gets or sets the subscription name that the user is requesting to + /// add the plan to + /// + [JsonProperty(PropertyName = "subscriptionName")] + public string SubscriptionName { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/PlanNotificationDetails.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/PlanNotificationDetails.cs new file mode 100644 index 000000000000..5e2c39bde6be --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/PlanNotificationDetails.cs @@ -0,0 +1,60 @@ +// +// 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; + + /// + /// Plan notification details + /// + public partial class PlanNotificationDetails + { + /// + /// Initializes a new instance of the PlanNotificationDetails class. + /// + public PlanNotificationDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PlanNotificationDetails class. + /// + /// Gets or sets the plan id + /// Gets or sets the plan display + /// name + public PlanNotificationDetails(string planId = default(string), string planDisplayName = default(string)) + { + PlanId = planId; + PlanDisplayName = planDisplayName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the plan id + /// + [JsonProperty(PropertyName = "planId")] + public string PlanId { get; set; } + + /// + /// Gets or sets the plan display name + /// + [JsonProperty(PropertyName = "planDisplayName")] + public string PlanDisplayName { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/PlanRequesterDetails.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/PlanRequesterDetails.cs new file mode 100644 index 000000000000..46422daaa883 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/PlanRequesterDetails.cs @@ -0,0 +1,69 @@ +// +// 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; + + /// + /// Plan with requesters details + /// + public partial class PlanRequesterDetails + { + /// + /// Initializes a new instance of the PlanRequesterDetails class. + /// + public PlanRequesterDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PlanRequesterDetails class. + /// + /// Gets the plan id + /// Gets the plan display name + /// Gets requesters details list + public PlanRequesterDetails(string planId = default(string), string planDisplayName = default(string), IList requesters = default(IList)) + { + PlanId = planId; + PlanDisplayName = planDisplayName; + Requesters = requesters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the plan id + /// + [JsonProperty(PropertyName = "planId")] + public string PlanId { get; private set; } + + /// + /// Gets the plan display name + /// + [JsonProperty(PropertyName = "planDisplayName")] + public string PlanDisplayName { get; private set; } + + /// + /// Gets requesters details list + /// + [JsonProperty(PropertyName = "requesters")] + public IList Requesters { get; private set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/PrivateStore.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/PrivateStore.cs index 3ee14dff6f50..f61d7338f8ff 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/PrivateStore.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/PrivateStore.cs @@ -37,36 +37,31 @@ public PrivateStore() /// The resource ID. /// The name of the resource. /// The type of the resource. + /// Metadata pertaining to creation and last + /// modification of the resource /// Indicates private store availability. /// Possible values include: 'enabled', 'disabled' /// Private Store id /// Identifier for purposes of race /// condition /// Private Store Name - /// Tenant Tag - /// Tenant ids - /// Customer tag - /// Indicating whether private - /// store has association with Commercial's Billing Account (through - /// billing account's customer tag retrieved from GSM for a - /// subscription - /// Indicating whether private - /// store has association with multiple tenants (through tenant's tag - /// retrieved from AAD + /// Tenant id /// Is government - public PrivateStore(string id = default(string), string name = default(string), string type = default(string), string availability = default(string), string privateStoreId = default(string), string eTag = default(string), string privateStoreName = default(string), string tenantTag = default(string), IList tenantIds = default(IList), string customerTag = default(string), bool? hasCommercialAssociation = default(bool?), bool? hasMultiTenantAssociation = default(bool?), bool? isGov = default(bool?)) - : base(id, name, type) + /// Gets list of associated collection + /// ids + /// Gets or sets list of branding + /// characteristics + public PrivateStore(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string availability = default(string), string privateStoreId = default(string), string eTag = default(string), string privateStoreName = default(string), string tenantId = default(string), bool? isGov = default(bool?), IList collectionIds = default(IList), IDictionary branding = default(IDictionary)) + : base(id, name, type, systemData) { Availability = availability; PrivateStoreId = privateStoreId; ETag = eTag; PrivateStoreName = privateStoreName; - TenantTag = tenantTag; - TenantIds = tenantIds; - CustomerTag = customerTag; - HasCommercialAssociation = hasCommercialAssociation; - HasMultiTenantAssociation = hasMultiTenantAssociation; + TenantId = tenantId; IsGov = isGov; + CollectionIds = collectionIds; + Branding = branding; CustomInit(); } @@ -83,10 +78,10 @@ public PrivateStore() public string Availability { get; set; } /// - /// Gets or sets private Store id + /// Gets private Store id /// [JsonProperty(PropertyName = "properties.privateStoreId")] - public string PrivateStoreId { get; set; } + public string PrivateStoreId { get; private set; } /// /// Gets or sets identifier for purposes of race condition @@ -101,43 +96,28 @@ public PrivateStore() public string PrivateStoreName { get; set; } /// - /// Gets or sets tenant Tag + /// Gets or sets tenant id /// - [JsonProperty(PropertyName = "properties.tenantTag")] - public string TenantTag { get; set; } + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } /// - /// Gets or sets tenant ids - /// - [JsonProperty(PropertyName = "properties.tenantIds")] - public IList TenantIds { get; set; } - - /// - /// Gets or sets customer tag - /// - [JsonProperty(PropertyName = "properties.customerTag")] - public string CustomerTag { get; set; } - - /// - /// Gets or sets indicating whether private store has association with - /// Commercial's Billing Account (through billing account's customer - /// tag retrieved from GSM for a subscription + /// Gets or sets is government /// - [JsonProperty(PropertyName = "properties.hasCommercialAssociation")] - public bool? HasCommercialAssociation { get; set; } + [JsonProperty(PropertyName = "properties.isGov")] + public bool? IsGov { get; set; } /// - /// Gets or sets indicating whether private store has association with - /// multiple tenants (through tenant's tag retrieved from AAD + /// Gets list of associated collection ids /// - [JsonProperty(PropertyName = "properties.hasMultiTenantAssociation")] - public bool? HasMultiTenantAssociation { get; set; } + [JsonProperty(PropertyName = "properties.collectionIds")] + public IList CollectionIds { get; private set; } /// - /// Gets or sets is government + /// Gets or sets list of branding characteristics /// - [JsonProperty(PropertyName = "properties.isGov")] - public bool? IsGov { get; set; } + [JsonProperty(PropertyName = "properties.branding")] + public IDictionary Branding { get; set; } } } diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/PrivateStoreNotificationsState.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/PrivateStoreNotificationsState.cs new file mode 100644 index 000000000000..1365f2487938 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/PrivateStoreNotificationsState.cs @@ -0,0 +1,65 @@ +// +// 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; + + /// + /// Get private store notifications state + /// + public partial class PrivateStoreNotificationsState + { + /// + /// Initializes a new instance of the PrivateStoreNotificationsState + /// class. + /// + public PrivateStoreNotificationsState() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateStoreNotificationsState + /// class. + /// + public PrivateStoreNotificationsState(IList stopSellNotifications = default(IList), IList newNotifications = default(IList), IList approvalRequests = default(IList)) + { + StopSellNotifications = stopSellNotifications; + NewNotifications = newNotifications; + ApprovalRequests = approvalRequests; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "stopSellNotifications")] + public IList StopSellNotifications { get; set; } + + /// + /// + [JsonProperty(PropertyName = "newNotifications")] + public IList NewNotifications { get; set; } + + /// + /// + [JsonProperty(PropertyName = "approvalRequests")] + public IList ApprovalRequests { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/QueryApprovedPlansDetails.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/QueryApprovedPlansDetails.cs new file mode 100644 index 000000000000..9f0a50b4ed60 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/QueryApprovedPlansDetails.cs @@ -0,0 +1,79 @@ +// +// 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; + + /// + /// Query approved plans response + /// + public partial class QueryApprovedPlansDetails + { + /// + /// Initializes a new instance of the QueryApprovedPlansDetails class. + /// + public QueryApprovedPlansDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QueryApprovedPlansDetails class. + /// + /// Plan id + /// 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. + /// Indicates whether all subscriptions + /// are approved for this plan + public QueryApprovedPlansDetails(string planId = default(string), IList subscriptionIds = default(IList), bool? allSubscriptions = default(bool?)) + { + PlanId = planId; + SubscriptionIds = subscriptionIds; + AllSubscriptions = allSubscriptions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets plan id + /// + [JsonProperty(PropertyName = "planId")] + public string PlanId { get; set; } + + /// + /// Gets or sets 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. + /// + [JsonProperty(PropertyName = "subscriptionIds")] + public IList SubscriptionIds { get; set; } + + /// + /// Gets or sets indicates whether all subscriptions are approved for + /// this plan + /// + [JsonProperty(PropertyName = "allSubscriptions")] + public bool? AllSubscriptions { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/QueryApprovedPlansPayload.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/QueryApprovedPlansPayload.cs new file mode 100644 index 000000000000..47acfbec56d8 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/QueryApprovedPlansPayload.cs @@ -0,0 +1,64 @@ +// +// 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 Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Query approved plans payload + /// + [Rest.Serialization.JsonTransformation] + public partial class QueryApprovedPlansPayload + { + /// + /// Initializes a new instance of the QueryApprovedPlansPayload class. + /// + public QueryApprovedPlansPayload() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QueryApprovedPlansPayload class. + /// + /// Offer id + /// Offer plan ids + public QueryApprovedPlansPayload(string offerId = default(string), IList planIds = default(IList)) + { + OfferId = offerId; + PlanIds = planIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets offer id + /// + [JsonProperty(PropertyName = "properties.offerId")] + public string OfferId { get; set; } + + /// + /// Gets or sets offer plan ids + /// + [JsonProperty(PropertyName = "properties.planIds")] + public IList PlanIds { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/QueryApprovedPlansResponse.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/QueryApprovedPlansResponse.cs new file mode 100644 index 000000000000..a201909cf4f0 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/QueryApprovedPlansResponse.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; + + /// + /// Query approved plans response + /// + public partial class QueryApprovedPlansResponse + { + /// + /// Initializes a new instance of the QueryApprovedPlansResponse class. + /// + public QueryApprovedPlansResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QueryApprovedPlansResponse class. + /// + public QueryApprovedPlansResponse(IList details = default(IList)) + { + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/QueryOffers.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/QueryOffers.cs new file mode 100644 index 000000000000..2aee4680cc1a --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/QueryOffers.cs @@ -0,0 +1,61 @@ +// +// 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 offers + /// + public partial class QueryOffers + { + /// + /// Initializes a new instance of the QueryOffers class. + /// + public QueryOffers() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QueryOffers class. + /// + /// URL to get the next set of PrivateStore list + /// results if there are any. + public QueryOffers(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Gets or sets URL to get the next set of PrivateStore list results + /// if there are any. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/QueryRequestApproval.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/QueryRequestApproval.cs new file mode 100644 index 000000000000..79ae4c643c08 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/QueryRequestApproval.cs @@ -0,0 +1,79 @@ +// +// 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; + + /// + /// Gets the request plans with indication on each plan whether is approved + /// by the admin, has pending request or not requested yet + /// + public partial class QueryRequestApproval + { + /// + /// Initializes a new instance of the QueryRequestApproval class. + /// + public QueryRequestApproval() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QueryRequestApproval class. + /// + /// Gets or sets unique offer id. + /// Gets or sets the plans details + /// Gets or sets e-tag field + /// Gets or sets the notification message + /// id + public QueryRequestApproval(string uniqueOfferId = default(string), IDictionary plansDetails = default(IDictionary), string etag = default(string), long? messageCode = default(long?)) + { + UniqueOfferId = uniqueOfferId; + PlansDetails = plansDetails; + Etag = etag; + MessageCode = messageCode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unique offer id. + /// + [JsonProperty(PropertyName = "uniqueOfferId")] + public string UniqueOfferId { get; set; } + + /// + /// Gets or sets the plans details + /// + [JsonProperty(PropertyName = "plansDetails")] + public IDictionary PlansDetails { get; set; } + + /// + /// Gets or sets e-tag field + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + + /// + /// Gets or sets the notification message id + /// + [JsonProperty(PropertyName = "messageCode")] + public long? MessageCode { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/QueryRequestApprovalProperties.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/QueryRequestApprovalProperties.cs new file mode 100644 index 000000000000..8d8e90e7807b --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/QueryRequestApprovalProperties.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.Management.Marketplace.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The details to get the request plans statuses + /// + public partial class QueryRequestApprovalProperties + { + /// + /// Initializes a new instance of the QueryRequestApprovalProperties + /// class. + /// + public QueryRequestApprovalProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QueryRequestApprovalProperties + /// class. + /// + /// The details to get the request plans + /// statuses + public QueryRequestApprovalProperties(RequestDetails properties = default(RequestDetails)) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the details to get the request plans statuses + /// + [JsonProperty(PropertyName = "properties")] + public RequestDetails Properties { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/RequestApprovalResource.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/RequestApprovalResource.cs new file mode 100644 index 000000000000..5e87c9e2b914 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/RequestApprovalResource.cs @@ -0,0 +1,104 @@ +// +// 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 Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Request approval resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class RequestApprovalResource : Resource + { + /// + /// Initializes a new instance of the RequestApprovalResource class. + /// + public RequestApprovalResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RequestApprovalResource class. + /// + /// The resource ID. + /// The name of the resource. + /// The type of the resource. + /// Metadata pertaining to creation and last + /// modification of the resource + /// Gets or sets unique offer id. + /// Gets offer display name + /// The offer's publisher id + /// Gets or sets the plans details + /// Gets a value indicating whether the request + /// is closed + /// Gets or sets the request approval message + /// code + public RequestApprovalResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string offerId = default(string), string offerDisplayName = default(string), string publisherId = default(string), IList plansDetails = default(IList), bool? isClosed = default(bool?), long? messageCode = default(long?)) + : base(id, name, type, systemData) + { + OfferId = offerId; + OfferDisplayName = offerDisplayName; + PublisherId = publisherId; + PlansDetails = plansDetails; + IsClosed = isClosed; + MessageCode = messageCode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unique offer id. + /// + [JsonProperty(PropertyName = "properties.offerId")] + public string OfferId { get; set; } + + /// + /// Gets offer display name + /// + [JsonProperty(PropertyName = "properties.offerDisplayName")] + public string OfferDisplayName { get; private set; } + + /// + /// Gets or sets the offer's publisher id + /// + [JsonProperty(PropertyName = "properties.publisherId")] + public string PublisherId { get; set; } + + /// + /// Gets or sets the plans details + /// + [JsonProperty(PropertyName = "properties.plansDetails")] + public IList PlansDetails { get; set; } + + /// + /// Gets a value indicating whether the request is closed + /// + [JsonProperty(PropertyName = "properties.isClosed")] + public bool? IsClosed { get; private set; } + + /// + /// Gets or sets the request approval message code + /// + [JsonProperty(PropertyName = "properties.messageCode")] + public long? MessageCode { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/RequestApprovalsDetails.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/RequestApprovalsDetails.cs new file mode 100644 index 000000000000..f91ead2f2de4 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/RequestApprovalsDetails.cs @@ -0,0 +1,95 @@ +// +// 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; + + /// + /// Request approvals details + /// + public partial class RequestApprovalsDetails + { + /// + /// Initializes a new instance of the RequestApprovalsDetails class. + /// + public RequestApprovalsDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RequestApprovalsDetails class. + /// + /// Gets offer id + /// Gets offer display name + /// Gets or sets publisher id + /// Gets or sets the notification message + /// id + /// Gets or sets the icon url + /// Gets or sets removed plans + /// notifications + public RequestApprovalsDetails(string offerId = default(string), string displayName = default(string), string publisherId = default(string), long? messageCode = default(long?), string icon = default(string), IList plans = default(IList)) + { + OfferId = offerId; + DisplayName = displayName; + PublisherId = publisherId; + MessageCode = messageCode; + Icon = icon; + Plans = plans; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets offer id + /// + [JsonProperty(PropertyName = "offerId")] + public string OfferId { get; set; } + + /// + /// Gets offer display name + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets publisher id + /// + [JsonProperty(PropertyName = "publisherId")] + public string PublisherId { get; set; } + + /// + /// Gets or sets the notification message id + /// + [JsonProperty(PropertyName = "messageCode")] + public long? MessageCode { get; set; } + + /// + /// Gets or sets the icon url + /// + [JsonProperty(PropertyName = "icon")] + public string Icon { get; set; } + + /// + /// Gets or sets removed plans notifications + /// + [JsonProperty(PropertyName = "plans")] + public IList Plans { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/RequestApprovalsList.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/RequestApprovalsList.cs new file mode 100644 index 000000000000..5679150e7583 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/RequestApprovalsList.cs @@ -0,0 +1,61 @@ +// +// 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 admin request approval resources + /// + public partial class RequestApprovalsList + { + /// + /// Initializes a new instance of the RequestApprovalsList class. + /// + public RequestApprovalsList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RequestApprovalsList class. + /// + /// URL to get the next set of notifications + /// list results if there are any. + public RequestApprovalsList(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Gets URL to get the next set of notifications list results if there + /// are any. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/RequestDetails.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/RequestDetails.cs new file mode 100644 index 000000000000..6ebfdf2975f3 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/RequestDetails.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; + + /// + /// Request details needed to get the plans statuses + /// + public partial class RequestDetails + { + /// + /// Initializes a new instance of the RequestDetails class. + /// + public RequestDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RequestDetails class. + /// + /// The offer's publisher id + /// Current plans list + /// Gets or sets the subscription + /// id + public RequestDetails(string publisherId = default(string), IList planIds = default(IList), string subscriptionId = default(string)) + { + PublisherId = publisherId; + PlanIds = planIds; + SubscriptionId = subscriptionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the offer's publisher id + /// + [JsonProperty(PropertyName = "publisherId")] + public string PublisherId { get; set; } + + /// + /// Gets or sets current plans list + /// + [JsonProperty(PropertyName = "planIds")] + public IList PlanIds { get; set; } + + /// + /// Gets or sets the subscription id + /// + [JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Resource.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Resource.cs index 99cad8283d60..8b60bc405e4e 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Resource.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Resource.cs @@ -34,11 +34,14 @@ public Resource() /// The resource ID. /// The name of the resource. /// The type of the resource. - public Resource(string id = default(string), string name = default(string), string type = default(string)) + /// Metadata pertaining to creation and last + /// modification of the resource + public Resource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) { Id = id; Name = name; Type = type; + SystemData = systemData; CustomInit(); } @@ -65,5 +68,12 @@ public Resource() [JsonProperty(PropertyName = "type")] public string Type { get; private set; } + /// + /// Gets metadata pertaining to creation and last modification of the + /// resource + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + } } diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Operation1.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SingleOperation.cs similarity index 51% rename from sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Operation1.cs rename to sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SingleOperation.cs index 274a38278e4f..a81539cc427a 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Operation1.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SingleOperation.cs @@ -16,27 +16,34 @@ namespace Microsoft.Azure.Management.Marketplace.Models /// /// Microsoft.Marketplace REST API operation /// - public partial class Operation1 + public partial class SingleOperation { /// - /// Initializes a new instance of the Operation1 class. + /// Initializes a new instance of the SingleOperation class. /// - public Operation1() + public SingleOperation() { CustomInit(); } /// - /// Initializes a new instance of the Operation1 class. + /// Initializes a new instance of the SingleOperation class. /// /// Operation name: /// {provider}/{resource}/{operation} + /// Indicates whether the operation is a + /// data action /// The object that represents the /// operation. - public Operation1(string name = default(string), OperationDisplay display = default(OperationDisplay)) + /// Origin of the operation + /// Properties of the operation + public SingleOperation(string name = default(string), bool? isDataAction = default(bool?), SingleOperationDisplay display = default(SingleOperationDisplay), string origin = default(string), object properties = default(object)) { Name = name; + IsDataAction = isDataAction; Display = display; + Origin = origin; + Properties = properties; CustomInit(); } @@ -51,11 +58,29 @@ public Operation1() [JsonProperty(PropertyName = "name")] public string Name { get; set; } + /// + /// Gets or sets indicates whether the operation is a data action + /// + [JsonProperty(PropertyName = "isDataAction")] + public bool? IsDataAction { get; set; } + /// /// Gets or sets the object that represents the operation. /// [JsonProperty(PropertyName = "display")] - public OperationDisplay Display { get; set; } + public SingleOperationDisplay Display { get; set; } + + /// + /// Gets or sets origin of the operation + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; set; } + + /// + /// Gets or sets properties of the operation + /// + [JsonProperty(PropertyName = "properties")] + public object Properties { get; set; } } } diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/OperationDisplay.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SingleOperationDisplay.cs similarity index 55% rename from sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/OperationDisplay.cs rename to sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SingleOperationDisplay.cs index 60e95ed45507..67695792f1df 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/OperationDisplay.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SingleOperationDisplay.cs @@ -16,29 +16,32 @@ namespace Microsoft.Azure.Management.Marketplace.Models /// /// The object that represents the operation. /// - public partial class OperationDisplay + public partial class SingleOperationDisplay { /// - /// Initializes a new instance of the OperationDisplay class. + /// Initializes a new instance of the SingleOperationDisplay class. /// - public OperationDisplay() + public SingleOperationDisplay() { CustomInit(); } /// - /// Initializes a new instance of the OperationDisplay class. + /// Initializes a new instance of the SingleOperationDisplay class. /// /// Service provider: /// Microsoft.Marketplace /// Resource on which the operation is - /// performed: Amendments - /// Operation type: Get Amendments etc. - public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string)) + /// performed + /// Operation type + /// Friendly description for the + /// operation, + public SingleOperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) { Provider = provider; Resource = resource; Operation = operation; + Description = description; CustomInit(); } @@ -48,23 +51,28 @@ public OperationDisplay() partial void CustomInit(); /// - /// Gets or sets service provider: Microsoft.Marketplace + /// Gets service provider: Microsoft.Marketplace /// [JsonProperty(PropertyName = "provider")] - public string Provider { get; set; } + public string Provider { get; private set; } /// - /// Gets or sets resource on which the operation is performed: - /// Amendments + /// Gets resource on which the operation is performed /// [JsonProperty(PropertyName = "resource")] - public string Resource { get; set; } + public string Resource { get; private set; } /// - /// Gets or sets operation type: Get Amendments etc. + /// Gets operation type /// [JsonProperty(PropertyName = "operation")] - public string Operation { get; set; } + public string Operation { get; private set; } + + /// + /// Gets friendly description for the operation, + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } } } diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Status.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Status.cs new file mode 100644 index 000000000000..04e88489c21d --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Status.cs @@ -0,0 +1,24 @@ +// +// 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 Status. + /// + public static class Status + { + public const string Pending = "Pending"; + public const string Rejected = "Rejected"; + public const string Approved = "Approved"; + public const string None = "None"; + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/StopSellNotifications.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/StopSellNotifications.cs new file mode 100644 index 000000000000..6d2a5faf2bb2 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/StopSellNotifications.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.Management.Marketplace.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Stop sell notification details + /// + public partial class StopSellNotifications + { + /// + /// Initializes a new instance of the StopSellNotifications class. + /// + public StopSellNotifications() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StopSellNotifications class. + /// + /// Gets offer id + /// Gets offer display name + /// Gets a value indicating whether entire offer + /// is in stop sell or only few of its plans + /// Gets or sets the notification message + /// id + /// Gets or sets the icon url + /// Gets or sets removed plans + /// notifications + public StopSellNotifications(string offerId = default(string), string displayName = default(string), bool? isEntire = default(bool?), long? messageCode = default(long?), string icon = default(string), IList plans = default(IList)) + { + OfferId = offerId; + DisplayName = displayName; + IsEntire = isEntire; + MessageCode = messageCode; + Icon = icon; + Plans = plans; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets offer id + /// + [JsonProperty(PropertyName = "offerId")] + public string OfferId { get; set; } + + /// + /// Gets offer display name + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; 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; set; } + + /// + /// Gets or sets the notification message id + /// + [JsonProperty(PropertyName = "messageCode")] + public long? MessageCode { get; set; } + + /// + /// Gets or sets the icon url + /// + [JsonProperty(PropertyName = "icon")] + public string Icon { get; set; } + + /// + /// Gets or sets removed plans notifications + /// + [JsonProperty(PropertyName = "plans")] + public IList Plans { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SystemData.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SystemData.cs new file mode 100644 index 000000000000..212d89488d8e --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SystemData.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.Management.Marketplace.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Read only system data + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// The identity that created the + /// resource. + /// The type of identity that created the + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// The timestamp of resource creation + /// (UTC) + /// The identity that last modified the + /// resource. + /// The type of identity that last + /// modified the resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The timestamp of resource last + /// modification (UTC) + public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity that created the resource. + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets the type of identity that created the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "createdByType")] + public string CreatedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource creation (UTC) + /// + [JsonProperty(PropertyName = "createdAt")] + public System.DateTime? CreatedAt { get; set; } + + /// + /// Gets or sets the identity that last modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public string LastModifiedBy { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "lastModifiedByType")] + public string LastModifiedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource last modification (UTC) + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public System.DateTime? LastModifiedAt { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/TransferOffersProperties.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/TransferOffersProperties.cs new file mode 100644 index 000000000000..e32b96e4e72a --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/TransferOffersProperties.cs @@ -0,0 +1,75 @@ +// +// 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 Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Transfer offers properties + /// + [Rest.Serialization.JsonTransformation] + public partial class TransferOffersProperties + { + /// + /// Initializes a new instance of the TransferOffersProperties class. + /// + public TransferOffersProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TransferOffersProperties class. + /// + /// Target collections ids + /// Operation to perform (For example: Copy or + /// Move) + /// Offers ids list to transfer from source + /// collection to target collection(s) + public TransferOffersProperties(IList targetCollections = default(IList), string operation = default(string), IList offerIdsList = default(IList)) + { + TargetCollections = targetCollections; + Operation = operation; + OfferIdsList = offerIdsList; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets target collections ids + /// + [JsonProperty(PropertyName = "properties.targetCollections")] + public IList TargetCollections { get; set; } + + /// + /// Gets or sets operation to perform (For example: Copy or Move) + /// + [JsonProperty(PropertyName = "properties.operation")] + public string Operation { get; set; } + + /// + /// Gets or sets offers ids list to transfer from source collection to + /// target collection(s) + /// + [JsonProperty(PropertyName = "properties.offerIdsList")] + public IList OfferIdsList { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/TransferOffersResponse.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/TransferOffersResponse.cs new file mode 100644 index 000000000000..5d1b84980385 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/TransferOffersResponse.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.Management.Marketplace.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The transfer items response. The response contains two lists that + /// indicate for each collection whether the operation succeeded or failed + /// + public partial class TransferOffersResponse + { + /// + /// Initializes a new instance of the TransferOffersResponse class. + /// + public TransferOffersResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TransferOffersResponse class. + /// + /// Succeeded collections + /// Failed collections + public TransferOffersResponse(IList succeeded = default(IList), IList failed = default(IList)) + { + Succeeded = succeeded; + Failed = failed; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets succeeded collections + /// + [JsonProperty(PropertyName = "succeeded")] + public IList Succeeded { get; set; } + + /// + /// Gets or sets failed collections + /// + [JsonProperty(PropertyName = "failed")] + public IList Failed { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/UserRequestDetails.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/UserRequestDetails.cs new file mode 100644 index 000000000000..fc2e99422317 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/UserRequestDetails.cs @@ -0,0 +1,87 @@ +// +// 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; + + /// + /// user request details + /// + public partial class UserRequestDetails + { + /// + /// Initializes a new instance of the UserRequestDetails class. + /// + public UserRequestDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserRequestDetails class. + /// + /// Gets user id + /// Gets request date + /// Gets justification + /// Gets the subscription id that the user + /// is requesting to add the plan to + /// Gets the subscription name that the + /// user is requesting to add the plan to + public UserRequestDetails(string user = default(string), string date = default(string), string justification = default(string), string subscriptionId = default(string), string subscriptionName = default(string)) + { + User = user; + Date = date; + Justification = justification; + SubscriptionId = subscriptionId; + SubscriptionName = subscriptionName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets user id + /// + [JsonProperty(PropertyName = "user")] + public string User { get; private set; } + + /// + /// Gets request date + /// + [JsonProperty(PropertyName = "date")] + public string Date { get; private set; } + + /// + /// Gets justification + /// + [JsonProperty(PropertyName = "justification")] + public string Justification { get; private set; } + + /// + /// Gets the subscription id that the user is requesting to add the + /// plan to + /// + [JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId { get; set; } + + /// + /// Gets the subscription name that the user is requesting to add the + /// plan to + /// + [JsonProperty(PropertyName = "subscriptionName")] + public string SubscriptionName { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/WithdrawProperties.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/WithdrawProperties.cs new file mode 100644 index 000000000000..3d8783358710 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/WithdrawProperties.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.Management.Marketplace.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Withdraw properties + /// + [Rest.Serialization.JsonTransformation] + public partial class WithdrawProperties + { + /// + /// Initializes a new instance of the WithdrawProperties class. + /// + public WithdrawProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WithdrawProperties class. + /// + /// Gets or sets Plan Id + /// The offer's publisher id + public WithdrawProperties(string planId = default(string), string publisherId = default(string)) + { + PlanId = planId; + PublisherId = publisherId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets Plan Id + /// + [JsonProperty(PropertyName = "properties.planId")] + public string PlanId { get; set; } + + /// + /// Gets or sets the offer's publisher id + /// + [JsonProperty(PropertyName = "properties.publisherId")] + public string PublisherId { get; set; } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Operations.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Operations.cs index 1e6f7abd78cb..eada669ff7e5 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Operations.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Operations.cs @@ -25,7 +25,7 @@ namespace Microsoft.Azure.Management.Marketplace /// /// Operations operations. /// - internal partial class Operations : IServiceOperations, IOperations + internal partial class Operations : IServiceOperations, IOperations { /// /// Initializes a new instance of the Operations class. @@ -36,7 +36,7 @@ internal partial class Operations : IServiceOperations /// Thrown when a required parameter is null /// - internal Operations(MarketplaceManagementClient client) + internal Operations(MarketplaceRPServiceClient client) { if (client == null) { @@ -46,9 +46,9 @@ internal Operations(MarketplaceManagementClient client) } /// - /// Gets a reference to the MarketplaceManagementClient + /// Gets a reference to the MarketplaceRPServiceClient /// - public MarketplaceManagementClient Client { get; private set; } + public MarketplaceRPServiceClient Client { get; private set; } /// /// Lists all of the available Microsoft.Marketplace REST API operations. diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOfferOperations.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreCollectionOfferOperations.cs similarity index 62% rename from sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOfferOperations.cs rename to sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreCollectionOfferOperations.cs index 6fd7fdb167ec..b3a523353014 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOfferOperations.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreCollectionOfferOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Marketplace using System.Threading.Tasks; /// - /// PrivateStoreOfferOperations operations. + /// PrivateStoreCollectionOfferOperations operations. /// - internal partial class PrivateStoreOfferOperations : IServiceOperations, IPrivateStoreOfferOperations + internal partial class PrivateStoreCollectionOfferOperations : IServiceOperations, IPrivateStoreCollectionOfferOperations { /// - /// Initializes a new instance of the PrivateStoreOfferOperations class. + /// Initializes a new instance of the PrivateStoreCollectionOfferOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class PrivateStoreOfferOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal PrivateStoreOfferOperations(MarketplaceManagementClient client) + internal PrivateStoreCollectionOfferOperations(MarketplaceRPServiceClient client) { if (client == null) { @@ -46,18 +46,18 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) } /// - /// Gets a reference to the MarketplaceManagementClient + /// Gets a reference to the MarketplaceRPServiceClient /// - public MarketplaceManagementClient Client { get; private set; } + public MarketplaceRPServiceClient Client { get; private set; } /// - /// Deletes an offer from the given private store. + /// Get a list of all private offers in the given private store and collection /// /// /// The store ID - must use the tenant ID /// - /// - /// The offer ID to update or delete + /// + /// The collection ID /// /// /// Headers that will be added to request. @@ -68,6 +68,9 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -77,20 +80,20 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string privateStoreId, string offerId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string privateStoreId, string collectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (privateStoreId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); } - if (offerId == null) - { - 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"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -99,15 +102,15 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("privateStoreId", privateStoreId); - tracingParameters.Add("offerId", offerId); + tracingParameters.Add("collectionId", collectionId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/offers/{offerId}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers").ToString(); _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); - _url = _url.Replace("{offerId}", System.Uri.EscapeDataString(offerId)); + _url = _url.Replace("{collectionId}", System.Uri.EscapeDataString(collectionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -120,7 +123,7 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -201,13 +204,31 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + 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); @@ -224,6 +245,9 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) /// /// The offer ID to update or delete /// + /// + /// The collection ID + /// /// /// Headers that will be added to request. /// @@ -245,7 +269,7 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string privateStoreId, string offerId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string privateStoreId, string offerId, string collectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (privateStoreId == null) { @@ -259,6 +283,10 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (collectionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "collectionId"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -268,14 +296,16 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("privateStoreId", privateStoreId); tracingParameters.Add("offerId", offerId); + tracingParameters.Add("collectionId", collectionId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/offers/{offerId}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}").ToString(); _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); _url = _url.Replace("{offerId}", System.Uri.EscapeDataString(offerId)); + _url = _url.Replace("{collectionId}", System.Uri.EscapeDataString(collectionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -402,7 +432,7 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) } /// - /// Update or add an offer to the default collection of the private store. + /// Update or add an offer to a specific collection of the private store. /// /// /// The store ID - must use the tenant ID @@ -410,6 +440,9 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) /// /// The offer ID to update or delete /// + /// + /// The collection ID + /// /// /// /// @@ -433,7 +466,7 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string privateStoreId, string offerId, Offer payload = default(Offer), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string privateStoreId, string offerId, string collectionId, Offer payload = default(Offer), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (privateStoreId == null) { @@ -447,6 +480,10 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (collectionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "collectionId"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -457,14 +494,16 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) tracingParameters.Add("payload", payload); tracingParameters.Add("privateStoreId", privateStoreId); tracingParameters.Add("offerId", offerId); + tracingParameters.Add("collectionId", collectionId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/offers/{offerId}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}").ToString(); _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); _url = _url.Replace("{offerId}", System.Uri.EscapeDataString(offerId)); + _url = _url.Replace("{collectionId}", System.Uri.EscapeDataString(collectionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -596,6 +635,180 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) return _result; } + /// + /// Deletes an offer from the given collection of private store. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The offer ID to update or delete + /// + /// + /// The collection ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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 DeleteWithHttpMessagesAsync(string privateStoreId, string offerId, string collectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (privateStoreId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); + } + if (offerId == null) + { + 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"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("offerId", offerId); + tracingParameters.Add("collectionId", collectionId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}").ToString(); + _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); + _url = _url.Replace("{offerId}", System.Uri.EscapeDataString(offerId)); + _url = _url.Replace("{collectionId}", System.Uri.EscapeDataString(collectionId)); + 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("DELETE"); + _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 && (int)_statusCode != 204) + { + 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Delete Private store offer. This is a workaround. /// @@ -605,8 +818,12 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) /// /// The offer ID to update or delete /// + /// + /// The collection ID + /// /// - /// Possible values include: 'DeletePrivateStoreOffer', 'Ping' + /// Possible values include: 'DeletePrivateStoreOffer', + /// 'DeletePrivateStoreCollection', 'DeletePrivateStoreCollectionOffer', 'Ping' /// /// /// Headers that will be added to request. @@ -626,7 +843,7 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task PostWithHttpMessagesAsync(string privateStoreId, string offerId, string payload = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task PostWithHttpMessagesAsync(string privateStoreId, string offerId, string collectionId, string payload = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (privateStoreId == null) { @@ -640,6 +857,10 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (collectionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "collectionId"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -650,14 +871,16 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) tracingParameters.Add("payload", payload); tracingParameters.Add("privateStoreId", privateStoreId); tracingParameters.Add("offerId", offerId); + tracingParameters.Add("collectionId", collectionId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/offers/{offerId}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/offers/{offerId}").ToString(); _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); _url = _url.Replace("{offerId}", System.Uri.EscapeDataString(offerId)); + _url = _url.Replace("{collectionId}", System.Uri.EscapeDataString(collectionId)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -771,5 +994,173 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) return _result; } + /// + /// Get a list of all private offers in the given private store and collection + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + 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("GET"); + _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; + } + } } diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreCollectionOfferOperationsExtensions.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreCollectionOfferOperationsExtensions.cs new file mode 100644 index 000000000000..87c43ef06108 --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreCollectionOfferOperationsExtensions.cs @@ -0,0 +1,289 @@ +// +// 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PrivateStoreCollectionOfferOperations. + /// + public static partial class PrivateStoreCollectionOfferOperationsExtensions + { + /// + /// Get a list of all private offers in the given private store and collection + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection ID + /// + public static IPage List(this IPrivateStoreCollectionOfferOperations operations, string privateStoreId, string collectionId) + { + return operations.ListAsync(privateStoreId, collectionId).GetAwaiter().GetResult(); + } + + /// + /// Get a list of all private offers in the given private store and collection + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection ID + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IPrivateStoreCollectionOfferOperations operations, string privateStoreId, string collectionId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(privateStoreId, collectionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets information about a specific offer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The offer ID to update or delete + /// + /// + /// The collection ID + /// + public static Offer Get(this IPrivateStoreCollectionOfferOperations operations, string privateStoreId, string offerId, string collectionId) + { + return operations.GetAsync(privateStoreId, offerId, collectionId).GetAwaiter().GetResult(); + } + + /// + /// Gets information about a specific offer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The offer ID to update or delete + /// + /// + /// The collection ID + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPrivateStoreCollectionOfferOperations operations, string privateStoreId, string offerId, string collectionId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(privateStoreId, offerId, collectionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update or add an offer to a specific collection of the private store. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The offer ID to update or delete + /// + /// + /// The collection ID + /// + /// + /// + public static Offer CreateOrUpdate(this IPrivateStoreCollectionOfferOperations operations, string privateStoreId, string offerId, string collectionId, Offer payload = default(Offer)) + { + return operations.CreateOrUpdateAsync(privateStoreId, offerId, collectionId, payload).GetAwaiter().GetResult(); + } + + /// + /// Update or add an offer to a specific collection of the private store. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The offer ID to update or delete + /// + /// + /// The collection ID + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IPrivateStoreCollectionOfferOperations operations, string privateStoreId, string offerId, string collectionId, Offer payload = default(Offer), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(privateStoreId, offerId, collectionId, payload, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an offer from the given collection of private store. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The offer ID to update or delete + /// + /// + /// The collection ID + /// + public static void Delete(this IPrivateStoreCollectionOfferOperations operations, string privateStoreId, string offerId, string collectionId) + { + operations.DeleteAsync(privateStoreId, offerId, collectionId).GetAwaiter().GetResult(); + } + + /// + /// Deletes an offer from the given collection of private store. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The offer ID to update or delete + /// + /// + /// The collection ID + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IPrivateStoreCollectionOfferOperations operations, string privateStoreId, string offerId, string collectionId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(privateStoreId, offerId, collectionId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Delete Private store offer. This is a workaround. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The offer ID to update or delete + /// + /// + /// The collection ID + /// + /// + /// Possible values include: 'DeletePrivateStoreOffer', + /// 'DeletePrivateStoreCollection', 'DeletePrivateStoreCollectionOffer', 'Ping' + /// + public static void Post(this IPrivateStoreCollectionOfferOperations operations, string privateStoreId, string offerId, string collectionId, string payload = default(string)) + { + operations.PostAsync(privateStoreId, offerId, collectionId, payload).GetAwaiter().GetResult(); + } + + /// + /// Delete Private store offer. This is a workaround. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The offer ID to update or delete + /// + /// + /// The collection ID + /// + /// + /// Possible values include: 'DeletePrivateStoreOffer', + /// 'DeletePrivateStoreCollection', 'DeletePrivateStoreCollectionOffer', 'Ping' + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IPrivateStoreCollectionOfferOperations operations, string privateStoreId, string offerId, string collectionId, string payload = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PostWithHttpMessagesAsync(privateStoreId, offerId, collectionId, payload, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get a list of all private offers in the given private store and collection + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IPrivateStoreCollectionOfferOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get a list of all private offers in the given private store and collection + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IPrivateStoreCollectionOfferOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreCollectionOperations.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreCollectionOperations.cs new file mode 100644 index 000000000000..e7247b44189b --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreCollectionOperations.cs @@ -0,0 +1,1149 @@ +// +// 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateStoreCollectionOperations operations. + /// + internal partial class PrivateStoreCollectionOperations : IServiceOperations, IPrivateStoreCollectionOperations + { + /// + /// Initializes a new instance of the PrivateStoreCollectionOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateStoreCollectionOperations(MarketplaceRPServiceClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the MarketplaceRPServiceClient + /// + public MarketplaceRPServiceClient Client { get; private set; } + + /// + /// Gets private store collections list + /// + /// + /// 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> ListWithHttpMessagesAsync(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, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections").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("GET"); + _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 private store collection + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection 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> GetWithHttpMessagesAsync(string privateStoreId, string collectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (privateStoreId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); + } + 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; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("collectionId", collectionId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}").ToString(); + _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); + _url = _url.Replace("{collectionId}", System.Uri.EscapeDataString(collectionId)); + 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("GET"); + _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; + } + + /// + /// Create or update private store collection + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection 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> CreateOrUpdateWithHttpMessagesAsync(string privateStoreId, string collectionId, Collection payload = default(Collection), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (privateStoreId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); + } + 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; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("payload", payload); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("collectionId", collectionId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}").ToString(); + _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); + _url = _url.Replace("{collectionId}", System.Uri.EscapeDataString(collectionId)); + 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("PUT"); + _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(payload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(payload, 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; + } + + /// + /// Delete a collection from the given private store. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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 DeleteWithHttpMessagesAsync(string privateStoreId, string collectionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (privateStoreId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); + } + 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; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("collectionId", collectionId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}").ToString(); + _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); + _url = _url.Replace("{collectionId}", System.Uri.EscapeDataString(collectionId)); + 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("DELETE"); + _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 && (int)_statusCode != 204) + { + 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete Private store collection. This is a workaround. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection ID + /// + /// + /// Possible values include: 'DeletePrivateStoreOffer', + /// 'DeletePrivateStoreCollection', 'DeletePrivateStoreCollectionOffer', 'Ping' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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 PostWithHttpMessagesAsync(string privateStoreId, string collectionId, string payload = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (privateStoreId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); + } + 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; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("payload", payload); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("collectionId", collectionId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}").ToString(); + _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); + _url = _url.Replace("{collectionId}", System.Uri.EscapeDataString(collectionId)); + 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(payload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(payload, 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// transferring offers (copy or move) from source collection to target + /// collection(s) + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection 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> TransferOffersWithHttpMessagesAsync(string privateStoreId, string collectionId, TransferOffersProperties payload = default(TransferOffersProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (privateStoreId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); + } + 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; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("payload", payload); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("collectionId", collectionId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "TransferOffers", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/transferOffers").ToString(); + _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); + _url = _url.Replace("{collectionId}", System.Uri.EscapeDataString(collectionId)); + 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(payload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(payload, 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; + } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreCollectionOperationsExtensions.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreCollectionOperationsExtensions.cs new file mode 100644 index 000000000000..5ecf8bae62eb --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreCollectionOperationsExtensions.cs @@ -0,0 +1,271 @@ +// +// 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PrivateStoreCollectionOperations. + /// + public static partial class PrivateStoreCollectionOperationsExtensions + { + /// + /// Gets private store collections list + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + public static CollectionsList List(this IPrivateStoreCollectionOperations operations, string privateStoreId) + { + return operations.ListAsync(privateStoreId).GetAwaiter().GetResult(); + } + + /// + /// Gets private store collections list + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IPrivateStoreCollectionOperations operations, string privateStoreId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(privateStoreId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets private store collection + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection ID + /// + public static Collection Get(this IPrivateStoreCollectionOperations operations, string privateStoreId, string collectionId) + { + return operations.GetAsync(privateStoreId, collectionId).GetAwaiter().GetResult(); + } + + /// + /// Gets private store collection + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection ID + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPrivateStoreCollectionOperations operations, string privateStoreId, string collectionId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(privateStoreId, collectionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update private store collection + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection ID + /// + /// + /// + public static Collection CreateOrUpdate(this IPrivateStoreCollectionOperations operations, string privateStoreId, string collectionId, Collection payload = default(Collection)) + { + return operations.CreateOrUpdateAsync(privateStoreId, collectionId, payload).GetAwaiter().GetResult(); + } + + /// + /// Create or update private store collection + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection ID + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IPrivateStoreCollectionOperations operations, string privateStoreId, string collectionId, Collection payload = default(Collection), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(privateStoreId, collectionId, payload, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a collection from the given private store. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection ID + /// + public static void Delete(this IPrivateStoreCollectionOperations operations, string privateStoreId, string collectionId) + { + operations.DeleteAsync(privateStoreId, collectionId).GetAwaiter().GetResult(); + } + + /// + /// Delete a collection from the given private store. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection ID + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IPrivateStoreCollectionOperations operations, string privateStoreId, string collectionId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(privateStoreId, collectionId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Delete Private store collection. This is a workaround. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection ID + /// + /// + /// Possible values include: 'DeletePrivateStoreOffer', + /// 'DeletePrivateStoreCollection', 'DeletePrivateStoreCollectionOffer', 'Ping' + /// + public static void Post(this IPrivateStoreCollectionOperations operations, string privateStoreId, string collectionId, string payload = default(string)) + { + operations.PostAsync(privateStoreId, collectionId, payload).GetAwaiter().GetResult(); + } + + /// + /// Delete Private store collection. This is a workaround. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection ID + /// + /// + /// Possible values include: 'DeletePrivateStoreOffer', + /// 'DeletePrivateStoreCollection', 'DeletePrivateStoreCollectionOffer', 'Ping' + /// + /// + /// The cancellation token. + /// + public static async Task PostAsync(this IPrivateStoreCollectionOperations operations, string privateStoreId, string collectionId, string payload = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PostWithHttpMessagesAsync(privateStoreId, collectionId, payload, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// transferring offers (copy or move) from source collection to target + /// collection(s) + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection ID + /// + /// + /// + public static TransferOffersResponse TransferOffers(this IPrivateStoreCollectionOperations operations, string privateStoreId, string collectionId, TransferOffersProperties payload = default(TransferOffersProperties)) + { + return operations.TransferOffersAsync(privateStoreId, collectionId, payload).GetAwaiter().GetResult(); + } + + /// + /// transferring offers (copy or move) from source collection to target + /// collection(s) + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The collection ID + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task TransferOffersAsync(this IPrivateStoreCollectionOperations operations, string privateStoreId, string collectionId, TransferOffersProperties payload = default(TransferOffersProperties), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.TransferOffersWithHttpMessagesAsync(privateStoreId, collectionId, payload, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOfferOperationsExtensions.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOfferOperationsExtensions.cs deleted file mode 100644 index f350569cb62e..000000000000 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOfferOperationsExtensions.cs +++ /dev/null @@ -1,189 +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.Management.Marketplace -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for PrivateStoreOfferOperations. - /// - public static partial class PrivateStoreOfferOperationsExtensions - { - /// - /// Deletes an offer from the given private store. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The store ID - must use the tenant ID - /// - /// - /// The offer ID to update or delete - /// - public static void Delete(this IPrivateStoreOfferOperations operations, string privateStoreId, string offerId) - { - operations.DeleteAsync(privateStoreId, offerId).GetAwaiter().GetResult(); - } - - /// - /// Deletes an offer from the given private store. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The store ID - must use the tenant ID - /// - /// - /// The offer ID to update or delete - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IPrivateStoreOfferOperations operations, string privateStoreId, string offerId, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(privateStoreId, offerId, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets information about a specific offer. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The store ID - must use the tenant ID - /// - /// - /// The offer ID to update or delete - /// - public static Offer Get(this IPrivateStoreOfferOperations operations, string privateStoreId, string offerId) - { - return operations.GetAsync(privateStoreId, offerId).GetAwaiter().GetResult(); - } - - /// - /// Gets information about a specific offer. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The store ID - must use the tenant ID - /// - /// - /// The offer ID to update or delete - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IPrivateStoreOfferOperations operations, string privateStoreId, string offerId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(privateStoreId, offerId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Update or add an offer to the default collection of the private store. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The store ID - must use the tenant ID - /// - /// - /// The offer ID to update or delete - /// - /// - /// - public static Offer CreateOrUpdate(this IPrivateStoreOfferOperations operations, string privateStoreId, string offerId, Offer payload = default(Offer)) - { - return operations.CreateOrUpdateAsync(privateStoreId, offerId, payload).GetAwaiter().GetResult(); - } - - /// - /// Update or add an offer to the default collection of the private store. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The store ID - must use the tenant ID - /// - /// - /// The offer ID to update or delete - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IPrivateStoreOfferOperations operations, string privateStoreId, string offerId, Offer payload = default(Offer), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(privateStoreId, offerId, payload, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete Private store offer. This is a workaround. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The store ID - must use the tenant ID - /// - /// - /// The offer ID to update or delete - /// - /// - /// Possible values include: 'DeletePrivateStoreOffer', 'Ping' - /// - public static void Post(this IPrivateStoreOfferOperations operations, string privateStoreId, string offerId, string payload = default(string)) - { - operations.PostAsync(privateStoreId, offerId, payload).GetAwaiter().GetResult(); - } - - /// - /// Delete Private store offer. This is a workaround. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The store ID - must use the tenant ID - /// - /// - /// The offer ID to update or delete - /// - /// - /// Possible values include: 'DeletePrivateStoreOffer', 'Ping' - /// - /// - /// The cancellation token. - /// - public static async Task PostAsync(this IPrivateStoreOfferOperations operations, string privateStoreId, string offerId, string payload = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.PostWithHttpMessagesAsync(privateStoreId, offerId, payload, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - } -} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOffersOperations.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOffersOperations.cs deleted file mode 100644 index e9075e4b1098..000000000000 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOffersOperations.cs +++ /dev/null @@ -1,399 +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.Management.Marketplace -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateStoreOffersOperations operations. - /// - internal partial class PrivateStoreOffersOperations : IServiceOperations, IPrivateStoreOffersOperations - { - /// - /// Initializes a new instance of the PrivateStoreOffersOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal PrivateStoreOffersOperations(MarketplaceManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MarketplaceManagementClient - /// - public MarketplaceManagementClient Client { get; private set; } - - /// - /// Get a list of all private offers in the given private store - /// - /// - /// 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>> ListWithHttpMessagesAsync(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, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/offers").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("GET"); - _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; - } - - /// - /// Get a list of all private offers in the given private store - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - 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("GET"); - _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; - } - - } -} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOffersOperationsExtensions.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOffersOperationsExtensions.cs deleted file mode 100644 index 0cf19a5929f0..000000000000 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOffersOperationsExtensions.cs +++ /dev/null @@ -1,93 +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.Management.Marketplace -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for PrivateStoreOffersOperations. - /// - public static partial class PrivateStoreOffersOperationsExtensions - { - /// - /// Get a list of all private offers in the given private store - /// - /// - /// The operations group for this extension method. - /// - /// - /// The store ID - must use the tenant ID - /// - public static IPage List(this IPrivateStoreOffersOperations operations, string privateStoreId) - { - return operations.ListAsync(privateStoreId).GetAwaiter().GetResult(); - } - - /// - /// Get a list of all private offers in the given private store - /// - /// - /// The operations group for this extension method. - /// - /// - /// The store ID - must use the tenant ID - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IPrivateStoreOffersOperations operations, string privateStoreId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(privateStoreId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get a list of all private offers in the given private store - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IPrivateStoreOffersOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Get a list of all private offers in the given private store - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListNextAsync(this IPrivateStoreOffersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} 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 785db03675df..f2cba7daa808 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOperations.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOperations.cs @@ -25,7 +25,7 @@ namespace Microsoft.Azure.Management.Marketplace /// /// PrivateStoreOperations operations. /// - internal partial class PrivateStoreOperations : IServiceOperations, IPrivateStoreOperations + internal partial class PrivateStoreOperations : IServiceOperations, IPrivateStoreOperations { /// /// Initializes a new instance of the PrivateStoreOperations class. @@ -36,7 +36,7 @@ internal partial class PrivateStoreOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal PrivateStoreOperations(MarketplaceManagementClient client) + internal PrivateStoreOperations(MarketplaceRPServiceClient client) { if (client == null) { @@ -46,12 +46,12 @@ internal PrivateStoreOperations(MarketplaceManagementClient client) } /// - /// Gets a reference to the MarketplaceManagementClient + /// Gets a reference to the MarketplaceRPServiceClient /// - public MarketplaceManagementClient Client { get; private set; } + public MarketplaceRPServiceClient Client { get; private set; } /// - /// Gets the list of available private stores + /// Gets the list of available private stores. /// /// /// Determines if to use cache or DB for serving this request @@ -403,6 +403,171 @@ internal PrivateStoreOperations(MarketplaceManagementClient client) return _result; } + /// + /// Changes private store properties + /// + /// + /// 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 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 CreateOrUpdateWithHttpMessagesAsync(string privateStoreId, PrivateStore payload = default(PrivateStore), 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("payload", payload); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}").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("PUT"); + _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(payload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(payload, 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Deletes the private store. All that is not saved will be lost. /// @@ -515,7 +680,7 @@ internal PrivateStoreOperations(MarketplaceManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 204) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -560,13 +725,11 @@ internal PrivateStoreOperations(MarketplaceManagementClient client) } /// - /// Changes private store properties + /// List of offers, regardless the collections /// /// /// The store ID - must use the tenant ID /// - /// - /// /// /// Headers that will be added to request. /// @@ -576,6 +739,9 @@ internal PrivateStoreOperations(MarketplaceManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -585,7 +751,7 @@ internal PrivateStoreOperations(MarketplaceManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task CreateOrUpdateWithHttpMessagesAsync(string privateStoreId, PrivateStore payload = default(PrivateStore), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> QueryOffersMethodWithHttpMessagesAsync(string privateStoreId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (privateStoreId == null) { @@ -602,14 +768,13 @@ internal PrivateStoreOperations(MarketplaceManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("payload", payload); tracingParameters.Add("privateStoreId", privateStoreId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "QueryOffersMethod", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryOffers").ToString(); _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -623,7 +788,2605 @@ internal PrivateStoreOperations(MarketplaceManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _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; + } + + /// + /// Tenant billing accounts names + /// + /// + /// 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> BillingAccountsWithHttpMessagesAsync(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, "BillingAccounts", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/billingAccounts").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; + } + + /// + /// 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 + /// + /// + /// + /// + /// 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> CollectionsToSubscriptionsMappingWithHttpMessagesAsync(string privateStoreId, CollectionsToSubscriptionsMappingPayload payload = default(CollectionsToSubscriptionsMappingPayload), 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("payload", payload); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CollectionsToSubscriptionsMapping", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collectionsToSubscriptionsMapping").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(payload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(payload, 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; + } + + /// + /// Get map of plans and related approved subscriptions. + /// + /// + /// 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> QueryApprovedPlansMethodWithHttpMessagesAsync(string privateStoreId, QueryApprovedPlansPayload payload = default(QueryApprovedPlansPayload), 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("payload", payload); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "QueryApprovedPlansMethod", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryApprovedPlans").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(payload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(payload, 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; + } + + /// + /// Perform an action on bulk collections + /// + /// + /// 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> BulkCollectionsActionWithHttpMessagesAsync(string privateStoreId, BulkCollectionsPayload payload = default(BulkCollectionsPayload), 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("payload", payload); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BulkCollectionsAction", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/bulkCollectionsAction").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(payload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(payload, 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; + } + + /// + /// Get all open approval requests of current user + /// + /// + /// 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> GetApprovalRequestsListWithHttpMessagesAsync(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, "GetApprovalRequestsList", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals").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("GET"); + _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; + } + + /// + /// Get open request approval details + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The request approval ID to get create or update + /// + /// + /// 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> GetRequestApprovalWithHttpMessagesAsync(string privateStoreId, string requestApprovalId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (privateStoreId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); + } + if (requestApprovalId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "requestApprovalId"); + } + 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("requestApprovalId", requestApprovalId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetRequestApproval", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals/{requestApprovalId}").ToString(); + _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); + _url = _url.Replace("{requestApprovalId}", System.Uri.EscapeDataString(requestApprovalId)); + 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("GET"); + _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; + } + + /// + /// Create approval request + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The request approval ID to get create or update + /// + /// + /// + /// + /// 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> CreateApprovalRequestWithHttpMessagesAsync(string privateStoreId, string requestApprovalId, RequestApprovalResource payload = default(RequestApprovalResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (privateStoreId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); + } + if (requestApprovalId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "requestApprovalId"); + } + 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("payload", payload); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("requestApprovalId", requestApprovalId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateApprovalRequest", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals/{requestApprovalId}").ToString(); + _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); + _url = _url.Replace("{requestApprovalId}", System.Uri.EscapeDataString(requestApprovalId)); + 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("PUT"); + _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(payload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(payload, 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; + } + + /// + /// 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 + /// + /// + /// + /// + /// 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> QueryRequestApprovalMethodWithHttpMessagesAsync(string privateStoreId, string requestApprovalId, QueryRequestApprovalProperties payload = default(QueryRequestApprovalProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (privateStoreId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); + } + if (requestApprovalId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "requestApprovalId"); + } + 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("payload", payload); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("requestApprovalId", requestApprovalId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "QueryRequestApprovalMethod", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals/{requestApprovalId}/query").ToString(); + _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); + _url = _url.Replace("{requestApprovalId}", System.Uri.EscapeDataString(requestApprovalId)); + 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(payload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(payload, 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; + } + + /// + /// Get list of admin request approvals + /// + /// + /// 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> AdminRequestApprovalsListMethodWithHttpMessagesAsync(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, "AdminRequestApprovalsListMethod", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/adminRequestApprovals").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("GET"); + _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; + } + + /// + /// 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 + /// + /// + /// 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> GetAdminRequestApprovalWithHttpMessagesAsync(string publisherId, string privateStoreId, string adminRequestApprovalId, 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"); + } + if (adminRequestApprovalId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "adminRequestApprovalId"); + } + 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("publisherId", publisherId); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("adminRequestApprovalId", adminRequestApprovalId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetAdminRequestApproval", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/adminRequestApprovals/{adminRequestApprovalId}").ToString(); + _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); + _url = _url.Replace("{adminRequestApprovalId}", System.Uri.EscapeDataString(adminRequestApprovalId)); + List _queryParameters = new List(); + if (publisherId != null) + { + _queryParameters.Add(string.Format("publisherId={0}", System.Uri.EscapeDataString(publisherId))); + } + 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("GET"); + _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; + } + + /// + /// 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 + /// + /// + /// + /// + /// 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> UpdateAdminRequestApprovalWithHttpMessagesAsync(string privateStoreId, string adminRequestApprovalId, AdminRequestApprovalsResource payload = default(AdminRequestApprovalsResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (privateStoreId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); + } + if (adminRequestApprovalId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "adminRequestApprovalId"); + } + 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("payload", payload); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("adminRequestApprovalId", adminRequestApprovalId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateAdminRequestApproval", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/adminRequestApprovals/{adminRequestApprovalId}").ToString(); + _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); + _url = _url.Replace("{adminRequestApprovalId}", System.Uri.EscapeDataString(adminRequestApprovalId)); + 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("PUT"); + _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(payload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(payload, 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; + } + + /// + /// Get private store notifications state + /// + /// + /// 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> QueryNotificationsStateWithHttpMessagesAsync(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, "QueryNotificationsState", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryNotificationsState").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; + } + + /// + /// Acknowledge notification for offer + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The offer ID to update or delete + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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 AcknowledgeOfferNotificationWithHttpMessagesAsync(string privateStoreId, string offerId, AcknowledgeOfferNotificationProperties payload = default(AcknowledgeOfferNotificationProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (privateStoreId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); + } + if (offerId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "offerId"); + } + 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("payload", payload); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("offerId", offerId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "AcknowledgeOfferNotification", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/offers/{offerId}/acknowledgeNotification").ToString(); + _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); + _url = _url.Replace("{offerId}", System.Uri.EscapeDataString(offerId)); + 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(payload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(payload, 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// 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 + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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 WithdrawPlanWithHttpMessagesAsync(string privateStoreId, string requestApprovalId, WithdrawProperties payload = default(WithdrawProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (privateStoreId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); + } + if (requestApprovalId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "requestApprovalId"); + } + 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("payload", payload); + tracingParameters.Add("privateStoreId", privateStoreId); + tracingParameters.Add("requestApprovalId", requestApprovalId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "WithdrawPlan", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Marketplace/privateStores/{privateStoreId}/requestApprovals/{requestApprovalId}/withdrawPlan").ToString(); + _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); + _url = _url.Replace("{requestApprovalId}", System.Uri.EscapeDataString(requestApprovalId)); + 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) @@ -725,7 +3488,7 @@ internal PrivateStoreOperations(MarketplaceManagementClient client) } /// - /// Gets the list of available private stores + /// Gets the list of available private stores. /// /// /// The NextLink from the previous successful call to List operation. 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 34fee3e3addb..4f687bf672d5 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOperationsExtensions.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Marketplace public static partial class PrivateStoreOperationsExtensions { /// - /// Gets the list of available private stores + /// Gets the list of available private stores. /// /// /// The operations group for this extension method. @@ -36,7 +36,7 @@ public static partial class PrivateStoreOperationsExtensions } /// - /// Gets the list of available private stores + /// Gets the list of available private stores. /// /// /// The operations group for this extension method. @@ -89,6 +89,41 @@ public static PrivateStore Get(this IPrivateStoreOperations operations, string p } } + /// + /// Changes private store properties + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// + public static void CreateOrUpdate(this IPrivateStoreOperations operations, string privateStoreId, PrivateStore payload = default(PrivateStore)) + { + operations.CreateOrUpdateAsync(privateStoreId, payload).GetAwaiter().GetResult(); + } + + /// + /// Changes private store properties + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IPrivateStoreOperations operations, string privateStoreId, PrivateStore payload = default(PrivateStore), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.CreateOrUpdateWithHttpMessagesAsync(privateStoreId, payload, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Deletes the private store. All that is not saved will be lost. /// @@ -121,7 +156,76 @@ public static void Delete(this IPrivateStoreOperations operations, string privat } /// - /// Changes private store properties + /// List of offers, regardless the collections + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + public static QueryOffers QueryOffersMethod(this IPrivateStoreOperations operations, string privateStoreId) + { + return operations.QueryOffersMethodAsync(privateStoreId).GetAwaiter().GetResult(); + } + + /// + /// List of offers, regardless the collections + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The cancellation token. + /// + public static async Task QueryOffersMethodAsync(this IPrivateStoreOperations operations, string privateStoreId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.QueryOffersMethodWithHttpMessagesAsync(privateStoreId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Tenant billing accounts names + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + public static BillingAccountsResponse BillingAccounts(this IPrivateStoreOperations operations, string privateStoreId) + { + return operations.BillingAccountsAsync(privateStoreId).GetAwaiter().GetResult(); + } + + /// + /// Tenant billing accounts names + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The cancellation token. + /// + public static async Task BillingAccountsAsync(this IPrivateStoreOperations operations, string privateStoreId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BillingAccountsWithHttpMessagesAsync(privateStoreId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// For a given subscriptions list, the API will return a map of collections + /// and the related subscriptions from the supplied list. /// /// /// The operations group for this extension method. @@ -131,13 +235,14 @@ public static void Delete(this IPrivateStoreOperations operations, string privat /// /// /// - public static void CreateOrUpdate(this IPrivateStoreOperations operations, string privateStoreId, PrivateStore payload = default(PrivateStore)) + public static CollectionsToSubscriptionsMappingResponse CollectionsToSubscriptionsMapping(this IPrivateStoreOperations operations, string privateStoreId, CollectionsToSubscriptionsMappingPayload payload = default(CollectionsToSubscriptionsMappingPayload)) { - operations.CreateOrUpdateAsync(privateStoreId, payload).GetAwaiter().GetResult(); + return operations.CollectionsToSubscriptionsMappingAsync(privateStoreId, payload).GetAwaiter().GetResult(); } /// - /// Changes private store properties + /// For a given subscriptions list, the API will return a map of collections + /// and the related subscriptions from the supplied list. /// /// /// The operations group for this extension method. @@ -150,13 +255,498 @@ public static void Delete(this IPrivateStoreOperations operations, string privat /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IPrivateStoreOperations operations, string privateStoreId, PrivateStore payload = default(PrivateStore), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CollectionsToSubscriptionsMappingAsync(this IPrivateStoreOperations operations, string privateStoreId, CollectionsToSubscriptionsMappingPayload payload = default(CollectionsToSubscriptionsMappingPayload), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.CreateOrUpdateWithHttpMessagesAsync(privateStoreId, payload, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.CollectionsToSubscriptionsMappingWithHttpMessagesAsync(privateStoreId, payload, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get map of plans and related approved subscriptions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// + public static QueryApprovedPlansResponse QueryApprovedPlansMethod(this IPrivateStoreOperations operations, string privateStoreId, QueryApprovedPlansPayload payload = default(QueryApprovedPlansPayload)) + { + return operations.QueryApprovedPlansMethodAsync(privateStoreId, payload).GetAwaiter().GetResult(); + } + + /// + /// Get map of plans and related approved subscriptions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task QueryApprovedPlansMethodAsync(this IPrivateStoreOperations operations, string privateStoreId, QueryApprovedPlansPayload payload = default(QueryApprovedPlansPayload), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.QueryApprovedPlansMethodWithHttpMessagesAsync(privateStoreId, payload, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Perform an action on bulk collections + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// + public static BulkCollectionsResponse BulkCollectionsAction(this IPrivateStoreOperations operations, string privateStoreId, BulkCollectionsPayload payload = default(BulkCollectionsPayload)) + { + return operations.BulkCollectionsActionAsync(privateStoreId, payload).GetAwaiter().GetResult(); + } + + /// + /// Perform an action on bulk collections + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BulkCollectionsActionAsync(this IPrivateStoreOperations operations, string privateStoreId, BulkCollectionsPayload payload = default(BulkCollectionsPayload), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BulkCollectionsActionWithHttpMessagesAsync(privateStoreId, payload, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all open approval requests of current user + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + public static RequestApprovalsList GetApprovalRequestsList(this IPrivateStoreOperations operations, string privateStoreId) + { + return operations.GetApprovalRequestsListAsync(privateStoreId).GetAwaiter().GetResult(); + } + + /// + /// Get all open approval requests of current user + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The cancellation token. + /// + public static async Task GetApprovalRequestsListAsync(this IPrivateStoreOperations operations, string privateStoreId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetApprovalRequestsListWithHttpMessagesAsync(privateStoreId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get open request approval details + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The request approval ID to get create or update + /// + public static RequestApprovalResource GetRequestApproval(this IPrivateStoreOperations operations, string privateStoreId, string requestApprovalId) + { + return operations.GetRequestApprovalAsync(privateStoreId, requestApprovalId).GetAwaiter().GetResult(); + } + + /// + /// Get open request approval details + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The request approval ID to get create or update + /// + /// + /// The cancellation token. + /// + public static async Task GetRequestApprovalAsync(this IPrivateStoreOperations operations, string privateStoreId, string requestApprovalId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetRequestApprovalWithHttpMessagesAsync(privateStoreId, requestApprovalId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create approval request + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The request approval ID to get create or update + /// + /// + /// + public static RequestApprovalResource CreateApprovalRequest(this IPrivateStoreOperations operations, string privateStoreId, string requestApprovalId, RequestApprovalResource payload = default(RequestApprovalResource)) + { + return operations.CreateApprovalRequestAsync(privateStoreId, requestApprovalId, payload).GetAwaiter().GetResult(); + } + + /// + /// Create approval request + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The request approval ID to get create or update + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateApprovalRequestAsync(this IPrivateStoreOperations operations, string privateStoreId, string requestApprovalId, RequestApprovalResource payload = default(RequestApprovalResource), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateApprovalRequestWithHttpMessagesAsync(privateStoreId, requestApprovalId, payload, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get request statuses foreach plan, this api is used as a complex GET + /// action. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The request approval ID to get create or update + /// + /// + /// + public static QueryRequestApproval QueryRequestApprovalMethod(this IPrivateStoreOperations operations, string privateStoreId, string requestApprovalId, QueryRequestApprovalProperties payload = default(QueryRequestApprovalProperties)) + { + return operations.QueryRequestApprovalMethodAsync(privateStoreId, requestApprovalId, payload).GetAwaiter().GetResult(); + } + + /// + /// Get request statuses foreach plan, this api is used as a complex GET + /// action. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The request approval ID to get create or update + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task QueryRequestApprovalMethodAsync(this IPrivateStoreOperations operations, string privateStoreId, string requestApprovalId, QueryRequestApprovalProperties payload = default(QueryRequestApprovalProperties), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.QueryRequestApprovalMethodWithHttpMessagesAsync(privateStoreId, requestApprovalId, payload, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get list of admin request approvals + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + public static AdminRequestApprovalsList AdminRequestApprovalsListMethod(this IPrivateStoreOperations operations, string privateStoreId) + { + return operations.AdminRequestApprovalsListMethodAsync(privateStoreId).GetAwaiter().GetResult(); + } + + /// + /// Get list of admin request approvals + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The cancellation token. + /// + public static async Task AdminRequestApprovalsListMethodAsync(this IPrivateStoreOperations operations, string privateStoreId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.AdminRequestApprovalsListMethodWithHttpMessagesAsync(privateStoreId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get open approval requests + /// + /// + /// 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) + { + return operations.GetAdminRequestApprovalAsync(publisherId, privateStoreId, adminRequestApprovalId).GetAwaiter().GetResult(); + } + + /// + /// Get open approval requests + /// + /// + /// 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 cancellation token. + /// + public static async Task GetAdminRequestApprovalAsync(this IPrivateStoreOperations operations, string publisherId, string privateStoreId, string adminRequestApprovalId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetAdminRequestApprovalWithHttpMessagesAsync(publisherId, privateStoreId, adminRequestApprovalId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the admin action, weather the request is approved or rejected and + /// the approved plans + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The admin request approval ID to get create or update + /// + /// + /// + public static AdminRequestApprovalsResource UpdateAdminRequestApproval(this IPrivateStoreOperations operations, string privateStoreId, string adminRequestApprovalId, AdminRequestApprovalsResource payload = default(AdminRequestApprovalsResource)) + { + return operations.UpdateAdminRequestApprovalAsync(privateStoreId, adminRequestApprovalId, payload).GetAwaiter().GetResult(); + } + + /// + /// Update the admin action, weather the request is approved or rejected and + /// the approved plans + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The admin request approval ID to get create or update + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAdminRequestApprovalAsync(this IPrivateStoreOperations operations, string privateStoreId, string adminRequestApprovalId, AdminRequestApprovalsResource payload = default(AdminRequestApprovalsResource), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateAdminRequestApprovalWithHttpMessagesAsync(privateStoreId, adminRequestApprovalId, payload, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get private store notifications state + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + public static PrivateStoreNotificationsState QueryNotificationsState(this IPrivateStoreOperations operations, string privateStoreId) + { + return operations.QueryNotificationsStateAsync(privateStoreId).GetAwaiter().GetResult(); + } + + /// + /// Get private store notifications state + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The cancellation token. + /// + public static async Task QueryNotificationsStateAsync(this IPrivateStoreOperations operations, string privateStoreId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.QueryNotificationsStateWithHttpMessagesAsync(privateStoreId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Acknowledge notification for offer + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The offer ID to update or delete + /// + /// + /// + public static void AcknowledgeOfferNotification(this IPrivateStoreOperations operations, string privateStoreId, string offerId, AcknowledgeOfferNotificationProperties payload = default(AcknowledgeOfferNotificationProperties)) + { + operations.AcknowledgeOfferNotificationAsync(privateStoreId, offerId, payload).GetAwaiter().GetResult(); + } + + /// + /// Acknowledge notification for offer + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The offer ID to update or delete + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task AcknowledgeOfferNotificationAsync(this IPrivateStoreOperations operations, string privateStoreId, string offerId, AcknowledgeOfferNotificationProperties payload = default(AcknowledgeOfferNotificationProperties), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.AcknowledgeOfferNotificationWithHttpMessagesAsync(privateStoreId, offerId, payload, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Withdraw a user request approval on specific plan + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The request approval ID to get create or update + /// + /// + /// + public static void WithdrawPlan(this IPrivateStoreOperations operations, string privateStoreId, string requestApprovalId, WithdrawProperties payload = default(WithdrawProperties)) + { + operations.WithdrawPlanAsync(privateStoreId, requestApprovalId, payload).GetAwaiter().GetResult(); + } + + /// + /// Withdraw a user request approval on specific plan + /// + /// + /// The operations group for this extension method. + /// + /// + /// The store ID - must use the tenant ID + /// + /// + /// The request approval ID to get create or update + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task WithdrawPlanAsync(this IPrivateStoreOperations operations, string privateStoreId, string requestApprovalId, WithdrawProperties payload = default(WithdrawProperties), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.WithdrawPlanWithHttpMessagesAsync(privateStoreId, requestApprovalId, payload, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Gets the list of available private stores + /// Gets the list of available private stores. /// /// /// The operations group for this extension method. @@ -170,7 +760,7 @@ public static IPage ListNext(this IPrivateStoreOperations operatio } /// - /// Gets the list of available private stores + /// Gets the list of available private stores. /// /// /// The operations group for this extension method. diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStorePrivateOfferOperations.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStorePrivateOfferOperations.cs deleted file mode 100644 index 707e583828f4..000000000000 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStorePrivateOfferOperations.cs +++ /dev/null @@ -1,454 +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.Management.Marketplace -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateStorePrivateOfferOperations operations. - /// - internal partial class PrivateStorePrivateOfferOperations : IServiceOperations, IPrivateStorePrivateOfferOperations - { - /// - /// Initializes a new instance of the PrivateStorePrivateOfferOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal PrivateStorePrivateOfferOperations(MarketplaceManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MarketplaceManagementClient - /// - public MarketplaceManagementClient Client { get; private set; } - - /// - /// Gets information about a specific private offer. - /// - /// - /// Subscription id of the private offers - /// - /// - /// The store ID - must use the tenant ID - /// - /// - /// The offer ID to update or delete - /// - /// - /// 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> GetWithHttpMessagesAsync(string subscriptionId, string privateStoreId, string offerId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (subscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId"); - } - if (privateStoreId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); - } - if (offerId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "offerId"); - } - 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("subscriptionId", subscriptionId); - tracingParameters.Add("privateStoreId", privateStoreId); - tracingParameters.Add("offerId", offerId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/offers/{offerId}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(subscriptionId)); - _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); - _url = _url.Replace("{offerId}", System.Uri.EscapeDataString(offerId)); - 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("GET"); - _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; - } - - /// - /// Update or add a private offer to the default collection of the private - /// store. - /// - /// - /// Subscription id of the private offers - /// - /// - /// The store ID - must use the tenant ID - /// - /// - /// The offer ID to update or delete - /// - /// - /// - /// - /// 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> CreateOrUpdateWithHttpMessagesAsync(string subscriptionId, string privateStoreId, string offerId, Offer payload = default(Offer), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (subscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId"); - } - if (privateStoreId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "privateStoreId"); - } - if (offerId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "offerId"); - } - 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("payload", payload); - tracingParameters.Add("subscriptionId", subscriptionId); - tracingParameters.Add("privateStoreId", privateStoreId); - tracingParameters.Add("offerId", offerId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/offers/{offerId}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(subscriptionId)); - _url = _url.Replace("{privateStoreId}", System.Uri.EscapeDataString(privateStoreId)); - _url = _url.Replace("{offerId}", System.Uri.EscapeDataString(offerId)); - 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("PUT"); - _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(payload != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(payload, 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; - } - - } -} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStorePrivateOfferOperationsExtensions.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStorePrivateOfferOperationsExtensions.cs deleted file mode 100644 index 5fa37f4179e5..000000000000 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStorePrivateOfferOperationsExtensions.cs +++ /dev/null @@ -1,123 +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.Management.Marketplace -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for PrivateStorePrivateOfferOperations. - /// - public static partial class PrivateStorePrivateOfferOperationsExtensions - { - /// - /// Gets information about a specific private offer. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Subscription id of the private offers - /// - /// - /// The store ID - must use the tenant ID - /// - /// - /// The offer ID to update or delete - /// - public static Offer Get(this IPrivateStorePrivateOfferOperations operations, string subscriptionId, string privateStoreId, string offerId) - { - return operations.GetAsync(subscriptionId, privateStoreId, offerId).GetAwaiter().GetResult(); - } - - /// - /// Gets information about a specific private offer. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Subscription id of the private offers - /// - /// - /// The store ID - must use the tenant ID - /// - /// - /// The offer ID to update or delete - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IPrivateStorePrivateOfferOperations operations, string subscriptionId, string privateStoreId, string offerId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(subscriptionId, privateStoreId, offerId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Update or add a private offer to the default collection of the private - /// store. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Subscription id of the private offers - /// - /// - /// The store ID - must use the tenant ID - /// - /// - /// The offer ID to update or delete - /// - /// - /// - public static Offer CreateOrUpdate(this IPrivateStorePrivateOfferOperations operations, string subscriptionId, string privateStoreId, string offerId, Offer payload = default(Offer)) - { - return operations.CreateOrUpdateAsync(subscriptionId, privateStoreId, offerId, payload).GetAwaiter().GetResult(); - } - - /// - /// Update or add a private offer to the default collection of the private - /// store. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Subscription id of the private offers - /// - /// - /// The store ID - must use the tenant ID - /// - /// - /// The offer ID to update or delete - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IPrivateStorePrivateOfferOperations operations, string subscriptionId, string privateStoreId, string offerId, Offer payload = default(Offer), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(subscriptionId, privateStoreId, offerId, payload, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStorePrivateOffersOperations.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStorePrivateOffersOperations.cs deleted file mode 100644 index 9dfb65ed7f7c..000000000000 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStorePrivateOffersOperations.cs +++ /dev/null @@ -1,408 +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.Management.Marketplace -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateStorePrivateOffersOperations operations. - /// - internal partial class PrivateStorePrivateOffersOperations : IServiceOperations, IPrivateStorePrivateOffersOperations - { - /// - /// Initializes a new instance of the PrivateStorePrivateOffersOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal PrivateStorePrivateOffersOperations(MarketplaceManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MarketplaceManagementClient - /// - public MarketplaceManagementClient Client { get; private set; } - - /// - /// Get a list of all private offers in the given private store - /// - /// - /// Subscription id of the private offers - /// - /// - /// 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>> ListWithHttpMessagesAsync(string subscriptionId, string privateStoreId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (subscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId"); - } - 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("subscriptionId", subscriptionId); - tracingParameters.Add("privateStoreId", privateStoreId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Marketplace/privateStores/{privateStoreId}/offers").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(subscriptionId)); - _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("GET"); - _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; - } - - /// - /// Get a list of all private offers in the given private store - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - 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("GET"); - _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; - } - - } -} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStorePrivateOffersOperationsExtensions.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStorePrivateOffersOperationsExtensions.cs deleted file mode 100644 index 78c0880e0bc1..000000000000 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStorePrivateOffersOperationsExtensions.cs +++ /dev/null @@ -1,99 +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.Management.Marketplace -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for PrivateStorePrivateOffersOperations. - /// - public static partial class PrivateStorePrivateOffersOperationsExtensions - { - /// - /// Get a list of all private offers in the given private store - /// - /// - /// The operations group for this extension method. - /// - /// - /// Subscription id of the private offers - /// - /// - /// The store ID - must use the tenant ID - /// - public static IPage List(this IPrivateStorePrivateOffersOperations operations, string subscriptionId, string privateStoreId) - { - return operations.ListAsync(subscriptionId, privateStoreId).GetAwaiter().GetResult(); - } - - /// - /// Get a list of all private offers in the given private store - /// - /// - /// The operations group for this extension method. - /// - /// - /// Subscription id of the private offers - /// - /// - /// The store ID - must use the tenant ID - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IPrivateStorePrivateOffersOperations operations, string subscriptionId, string privateStoreId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(subscriptionId, privateStoreId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get a list of all private offers in the given private store - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IPrivateStorePrivateOffersOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Get a list of all private offers in the given private store - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListNextAsync(this IPrivateStorePrivateOffersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/SdkInfo_MarketplaceManagementClient.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/SdkInfo_MarketplaceManagementClient.cs deleted file mode 100644 index d4c47e248bae..000000000000 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/SdkInfo_MarketplaceManagementClient.cs +++ /dev/null @@ -1,43 +0,0 @@ - -// -// Code 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 -{ - using System; - using System.Collections.Generic; - using System.Linq; - - internal static partial class SdkInfo - { - public static IEnumerable> ApiInfo_MarketplaceManagementClient - { - get - { - return new Tuple[] - { - new Tuple("Marketplace", "Operations", "2020-01-01"), - new Tuple("Marketplace", "PrivateStore", "2020-01-01"), - new Tuple("Marketplace", "PrivateStoreOffer", "2020-01-01"), - new Tuple("Marketplace", "PrivateStoreOffers", "2020-01-01"), - new Tuple("Marketplace", "PrivateStorePrivateOffer", "2020-01-01"), - new Tuple("Marketplace", "PrivateStorePrivateOffers", "2020-01-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/master/specification/marketplace/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\repo\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "d0a293561d4e54e8cc08e5092076c11e636caf30"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section - } -} - 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 new file mode 100644 index 000000000000..df5bab91e35a --- /dev/null +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/SdkInfo_MarketplaceRPService.cs @@ -0,0 +1,30 @@ + +// +// Code 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 +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_MarketplaceRPService + { + get + { + 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"), + }.AsEnumerable(); + } + } + } +}