diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IMarketplaceManagementClient.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IMarketplaceManagementClient.cs index d1a41e04716d..e9f7b188d683 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IMarketplaceManagementClient.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IMarketplaceManagementClient.cs @@ -64,16 +64,6 @@ public partial interface IMarketplaceManagementClient : System.IDisposable bool? GenerateClientRequestId { get; set; } - /// - /// Gets the IPrivateStoreOffersOperations. - /// - IPrivateStoreOffersOperations PrivateStoreOffers { get; } - - /// - /// Gets the IPrivateStorePrivateOffersOperations. - /// - IPrivateStorePrivateOffersOperations PrivateStorePrivateOffers { get; } - /// /// Gets the IPrivateStoreOfferOperations. /// diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreOfferOperations.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreOfferOperations.cs index 5586be176f92..aa83d6e0f3d0 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreOfferOperations.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStoreOfferOperations.cs @@ -23,6 +23,28 @@ namespace Microsoft.Azure.Management.Marketplace /// public partial interface IPrivateStoreOfferOperations { + /// + /// 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)); /// /// Deletes an offer from the given private store. /// @@ -123,5 +145,27 @@ 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)); + /// + /// 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/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/IPrivateStorePrivateOfferOperations.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStorePrivateOfferOperations.cs index 1f9ce71a006a..5240ae3c8755 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStorePrivateOfferOperations.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/IPrivateStorePrivateOfferOperations.cs @@ -23,6 +23,31 @@ namespace Microsoft.Azure.Management.Marketplace /// public partial interface IPrivateStorePrivateOfferOperations { + /// + /// 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)); /// /// Gets information about a specific private offer. /// @@ -82,5 +107,27 @@ public partial interface IPrivateStorePrivateOfferOperations /// 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)); + /// + /// 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/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/MarketplaceManagementClient.cs index 152f7cbbcb28..08e74eb9a5c9 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/MarketplaceManagementClient.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/MarketplaceManagementClient.cs @@ -69,16 +69,6 @@ public partial class MarketplaceManagementClient : ServiceClient public bool? GenerateClientRequestId { get; set; } - /// - /// Gets the IPrivateStoreOffersOperations. - /// - public virtual IPrivateStoreOffersOperations PrivateStoreOffers { get; private set; } - - /// - /// Gets the IPrivateStorePrivateOffersOperations. - /// - public virtual IPrivateStorePrivateOffersOperations PrivateStorePrivateOffers { get; private set; } - /// /// Gets the IPrivateStoreOfferOperations. /// @@ -340,8 +330,6 @@ 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); diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Icon.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Icon.cs deleted file mode 100644 index 37d12c3f5855..000000000000 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/Icon.cs +++ /dev/null @@ -1,58 +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.Models -{ - using Newtonsoft.Json; - using System.Linq; - - public partial class Icon - { - /// - /// Initializes a new instance of the Icon class. - /// - public Icon() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Icon class. - /// - /// Icon size. Possible values include: 'Small', - /// 'Medium', 'Large', 'Wide', 'Hero' - /// Icon uri - public Icon(string iconKind = default(string), string uri = default(string)) - { - IconKind = iconKind; - Uri = uri; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets icon size. Possible values include: 'Small', 'Medium', - /// 'Large', 'Wide', 'Hero' - /// - [JsonProperty(PropertyName = "iconKind")] - public string IconKind { get; set; } - - /// - /// Gets or sets icon uri - /// - [JsonProperty(PropertyName = "uri")] - public string Uri { 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..a285c33a1d04 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 @@ -146,5 +146,6 @@ public Offer() /// [JsonProperty(PropertyName = "properties.plans")] public IList Plans { get; set; } + } } 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/Operation1.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/Models/SingleOperation.cs similarity index 79% 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..81a622f3c4fc 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,24 +16,24 @@ 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} /// The object that represents the /// operation. - public Operation1(string name = default(string), OperationDisplay display = default(OperationDisplay)) + public SingleOperation(string name = default(string), SingleOperationDisplay display = default(SingleOperationDisplay)) { Name = name; Display = display; @@ -55,7 +55,7 @@ public Operation1() /// Gets or sets the object that represents the operation. /// [JsonProperty(PropertyName = "display")] - public OperationDisplay Display { get; set; } + public SingleOperationDisplay Display { 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 83% 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..d353fa00d45d 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,25 +16,25 @@ 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)) + public SingleOperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string)) { Provider = provider; Resource = resource; diff --git a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOfferOperations.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOfferOperations.cs index 6fd7fdb167ec..52a9c56a248c 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOfferOperations.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOfferOperations.cs @@ -50,6 +50,183 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) /// 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; + } + /// /// Deletes an offer from the given private store. /// @@ -771,5 +948,173 @@ internal PrivateStoreOfferOperations(MarketplaceManagementClient client) 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/PrivateStoreOfferOperationsExtensions.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOfferOperationsExtensions.cs index f350569cb62e..9e6af86eb58d 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOfferOperationsExtensions.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStoreOfferOperationsExtensions.cs @@ -21,6 +21,40 @@ namespace Microsoft.Azure.Management.Marketplace /// public static partial class PrivateStoreOfferOperationsExtensions { + /// + /// 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 IPrivateStoreOfferOperations 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 IPrivateStoreOfferOperations operations, string privateStoreId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(privateStoreId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Deletes an offer from the given private store. /// @@ -185,5 +219,39 @@ public static Offer Get(this IPrivateStoreOfferOperations operations, string pri (await operations.PostWithHttpMessagesAsync(privateStoreId, offerId, payload, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// 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 IPrivateStoreOfferOperations 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 IPrivateStoreOfferOperations 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/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/PrivateStorePrivateOfferOperations.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStorePrivateOfferOperations.cs index 707e583828f4..bd0a4f6dc8d7 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStorePrivateOfferOperations.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStorePrivateOfferOperations.cs @@ -50,6 +50,192 @@ internal PrivateStorePrivateOfferOperations(MarketplaceManagementClient client) /// 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; + } + /// /// Gets information about a specific private offer. /// @@ -450,5 +636,173 @@ internal PrivateStorePrivateOfferOperations(MarketplaceManagementClient client) 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/PrivateStorePrivateOfferOperationsExtensions.cs b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStorePrivateOfferOperationsExtensions.cs index 5fa37f4179e5..f4bb52b2512c 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStorePrivateOfferOperationsExtensions.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/PrivateStorePrivateOfferOperationsExtensions.cs @@ -21,6 +21,46 @@ namespace Microsoft.Azure.Management.Marketplace /// public static partial class PrivateStorePrivateOfferOperationsExtensions { + /// + /// 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 IPrivateStorePrivateOfferOperations 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 IPrivateStorePrivateOfferOperations operations, string subscriptionId, string privateStoreId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(subscriptionId, privateStoreId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets information about a specific private offer. /// @@ -119,5 +159,39 @@ public static Offer Get(this IPrivateStorePrivateOfferOperations operations, str } } + /// + /// 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 IPrivateStorePrivateOfferOperations 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 IPrivateStorePrivateOfferOperations 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/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 index d4c47e248bae..e471f7b6534f 100644 --- a/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/SdkInfo_MarketplaceManagementClient.cs +++ b/sdk/marketplace/Microsoft.Azure.Management.Marketplace/src/Generated/SdkInfo_MarketplaceManagementClient.cs @@ -22,22 +22,9 @@ public static IEnumerable> ApiInfo_MarketplaceMana 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 } } -