diff --git a/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/ACEProvisioningManagementPartnerAPIClient.cs b/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/ACEProvisioningManagementPartnerAPIClient.cs index 1cf0a4754b91..8b51cb3dc9d7 100644 --- a/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/ACEProvisioningManagementPartnerAPIClient.cs +++ b/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/ACEProvisioningManagementPartnerAPIClient.cs @@ -52,19 +52,20 @@ public partial class ACEProvisioningManagementPartnerAPIClient : ServiceClient - /// Gets or sets the preferred language for the response. + /// The preferred language for the response. /// public string AcceptLanguage { get; set; } /// - /// Gets or sets the retry timeout in seconds for Long Running Operations. - /// Default value is 30. + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. /// public int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is generated and - /// included in each request. Default is true. + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. /// public bool? GenerateClientRequestId { get; set; } @@ -78,6 +79,24 @@ public partial class ACEProvisioningManagementPartnerAPIClient : ServiceClient public virtual IOperationOperations Operation { get; private set; } + /// + /// Gets the IPartnersOperations. + /// + public virtual IPartnersOperations Partners { get; private set; } + + /// + /// Initializes a new instance of the ACEProvisioningManagementPartnerAPIClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling ACEProvisioningManagementPartnerAPIClient.Dispose(). False: will not dispose provided httpClient + protected ACEProvisioningManagementPartnerAPIClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + /// /// Initializes a new instance of the ACEProvisioningManagementPartnerAPIClient class. /// @@ -173,6 +192,33 @@ public ACEProvisioningManagementPartnerAPIClient(ServiceClientCredentials creden } } + /// + /// Initializes a new instance of the ACEProvisioningManagementPartnerAPIClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling ACEProvisioningManagementPartnerAPIClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public ACEProvisioningManagementPartnerAPIClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + /// /// Initializes a new instance of the ACEProvisioningManagementPartnerAPIClient class. /// @@ -281,6 +327,7 @@ private void Initialize() { Partner = new PartnerOperations(this); Operation = new OperationOperations(this); + Partners = new PartnersOperations(this); BaseUri = new System.Uri("https://management.azure.com"); ApiVersion = "2018-02-01"; AcceptLanguage = "en-US"; diff --git a/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/IACEProvisioningManagementPartnerAPIClient.cs b/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/IACEProvisioningManagementPartnerAPIClient.cs index 08e79ef057f1..44aece094bfb 100644 --- a/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/IACEProvisioningManagementPartnerAPIClient.cs +++ b/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/IACEProvisioningManagementPartnerAPIClient.cs @@ -46,19 +46,20 @@ public partial interface IACEProvisioningManagementPartnerAPIClient : System.IDi string ApiVersion { get; } /// - /// Gets or sets the preferred language for the response. + /// The preferred language for the response. /// string AcceptLanguage { get; set; } /// - /// Gets or sets the retry timeout in seconds for Long Running - /// Operations. Default value is 30. + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. /// int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is generated - /// and included in each request. Default is true. + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. /// bool? GenerateClientRequestId { get; set; } @@ -73,5 +74,10 @@ public partial interface IACEProvisioningManagementPartnerAPIClient : System.IDi /// IOperationOperations Operation { get; } + /// + /// Gets the IPartnersOperations. + /// + IPartnersOperations Partners { get; } + } } diff --git a/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/IPartnersOperations.cs b/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/IPartnersOperations.cs new file mode 100644 index 000000000000..db96c599d7db --- /dev/null +++ b/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/IPartnersOperations.cs @@ -0,0 +1,49 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code 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.ManagementPartner +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PartnersOperations operations. + /// + public partial interface IPartnersOperations + { + /// + /// Get a specific `Partner`. + /// + /// + /// Get the management partner using the objectId and tenantId. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/PartnersOperations.cs b/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/PartnersOperations.cs new file mode 100644 index 000000000000..1e91736811f2 --- /dev/null +++ b/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/PartnersOperations.cs @@ -0,0 +1,225 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagementPartner +{ + 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; + + /// + /// PartnersOperations operations. + /// + internal partial class PartnersOperations : IServiceOperations, IPartnersOperations + { + /// + /// Initializes a new instance of the PartnersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PartnersOperations(ACEProvisioningManagementPartnerAPIClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ACEProvisioningManagementPartnerAPIClient + /// + public ACEProvisioningManagementPartnerAPIClient Client { get; private set; } + + /// + /// Get a specific `Partner`. + /// + /// + /// Get the management partner using the objectId and tenantId. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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("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.ManagementPartner/partners").ToString(); + 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 ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _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/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/PartnersOperationsExtensions.cs b/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/PartnersOperationsExtensions.cs new file mode 100644 index 000000000000..2b1314348bfe --- /dev/null +++ b/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/PartnersOperationsExtensions.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.ManagementPartner +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PartnersOperations. + /// + public static partial class PartnersOperationsExtensions + { + /// + /// Get a specific `Partner`. + /// + /// + /// Get the management partner using the objectId and tenantId. + /// + /// + /// The operations group for this extension method. + /// + public static PartnerResponse Get(this IPartnersOperations operations) + { + return operations.GetAsync().GetAwaiter().GetResult(); + } + + /// + /// Get a specific `Partner`. + /// + /// + /// Get the management partner using the objectId and tenantId. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPartnersOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/SdkInfo_ACEProvisioningManagementPartnerAPI.cs b/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/SdkInfo_ACEProvisioningManagementPartnerAPI.cs index be7b24fb40c9..482c04374d2e 100644 --- a/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/SdkInfo_ACEProvisioningManagementPartnerAPI.cs +++ b/src/SDKs/ManagementPartner/Management.ManagementPartner/Generated/SdkInfo_ACEProvisioningManagementPartnerAPI.cs @@ -1,19 +1,29 @@ -using System; -using System.Collections.Generic; -using System.Linq; +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// -internal static partial class SdkInfo +namespace Microsoft.Azure.Management.ManagementPartner { - public static IEnumerable> ApiInfo_ACEProvisioningManagementPartnerAPI - { - get - { - return new Tuple[] - { + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_ACEProvisioningManagementPartnerAPI + { + get + { + return new Tuple[] + { new Tuple("ManagementPartner", "Operation", "2018-02-01"), new Tuple("ManagementPartner", "Partner", "2018-02-01"), - }.AsEnumerable(); - } - } + new Tuple("ManagementPartner", "Partners", "2018-02-01"), + }.AsEnumerable(); + } + } + } }