diff --git a/src/SDKs/HDInsight/DataPlane/AzSdk.RP.props b/src/SDKs/HDInsight/DataPlane/AzSdk.RP.props index e1fad98b38072..5ee90a10b2160 100644 --- a/src/SDKs/HDInsight/DataPlane/AzSdk.RP.props +++ b/src/SDKs/HDInsight/DataPlane/AzSdk.RP.props @@ -1,7 +1,7 @@ - HDInsightJobManagementClient_2018-11-01-preview; + HDInsight_2018-06-01-preview; $(PackageTags);$(CommonTags);$(AzureApiTag); \ No newline at end of file diff --git a/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/ClustersOperations.cs b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/ClustersOperations.cs index d6e048075b5b9..90d2da8c0e260 100644 --- a/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/ClustersOperations.cs +++ b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/ClustersOperations.cs @@ -898,6 +898,222 @@ internal ClustersOperations(HDInsightManagementClient client) return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// Gets the gateway settings for the specified cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster. + /// + /// + /// 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> GetGatewaySettingsWithHttpMessagesAsync(string resourceGroupName, string clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + 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("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetGatewaySettings", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/getGatewaySettings").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Configures the gateway settings on the specified cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster. + /// + /// + /// The cluster configurations. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task UpdateGatewaySettingsWithHttpMessagesAsync(string resourceGroupName, string clusterName, UpdateGatewaySettingsParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginUpdateGatewaySettingsWithHttpMessagesAsync(resourceGroupName, clusterName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Executes script actions on the specified HDInsight cluster. /// @@ -1669,6 +1885,190 @@ internal ClustersOperations(HDInsightManagementClient client) return _result; } + /// + /// Configures the gateway settings on the specified cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster. + /// + /// + /// The cluster configurations. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginUpdateGatewaySettingsWithHttpMessagesAsync(string resourceGroupName, string clusterName, UpdateGatewaySettingsParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdateGatewaySettings", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateGatewaySettings").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Executes script actions on the specified HDInsight cluster. /// diff --git a/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/ClustersOperationsExtensions.cs b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/ClustersOperationsExtensions.cs index 7513f2fc8148a..95423e0da04a2 100644 --- a/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/ClustersOperationsExtensions.cs +++ b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/ClustersOperationsExtensions.cs @@ -338,6 +338,89 @@ public static void RotateDiskEncryptionKey(this IClustersOperations operations, (await operations.RotateDiskEncryptionKeyWithHttpMessagesAsync(resourceGroupName, clusterName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Gets the gateway settings for the specified cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster. + /// + public static GatewaySettings GetGatewaySettings(this IClustersOperations operations, string resourceGroupName, string clusterName) + { + return operations.GetGatewaySettingsAsync(resourceGroupName, clusterName).GetAwaiter().GetResult(); + } + + /// + /// Gets the gateway settings for the specified cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster. + /// + /// + /// The cancellation token. + /// + public static async Task GetGatewaySettingsAsync(this IClustersOperations operations, string resourceGroupName, string clusterName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetGatewaySettingsWithHttpMessagesAsync(resourceGroupName, clusterName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Configures the gateway settings on the specified cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster. + /// + /// + /// The cluster configurations. + /// + public static void UpdateGatewaySettings(this IClustersOperations operations, string resourceGroupName, string clusterName, UpdateGatewaySettingsParameters parameters) + { + operations.UpdateGatewaySettingsAsync(resourceGroupName, clusterName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Configures the gateway settings on the specified cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster. + /// + /// + /// The cluster configurations. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateGatewaySettingsAsync(this IClustersOperations operations, string resourceGroupName, string clusterName, UpdateGatewaySettingsParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateGatewaySettingsWithHttpMessagesAsync(resourceGroupName, clusterName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Executes script actions on the specified HDInsight cluster. /// @@ -550,6 +633,49 @@ public static void BeginRotateDiskEncryptionKey(this IClustersOperations operati (await operations.BeginRotateDiskEncryptionKeyWithHttpMessagesAsync(resourceGroupName, clusterName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Configures the gateway settings on the specified cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster. + /// + /// + /// The cluster configurations. + /// + public static void BeginUpdateGatewaySettings(this IClustersOperations operations, string resourceGroupName, string clusterName, UpdateGatewaySettingsParameters parameters) + { + operations.BeginUpdateGatewaySettingsAsync(resourceGroupName, clusterName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Configures the gateway settings on the specified cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster. + /// + /// + /// The cluster configurations. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateGatewaySettingsAsync(this IClustersOperations operations, string resourceGroupName, string clusterName, UpdateGatewaySettingsParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginUpdateGatewaySettingsWithHttpMessagesAsync(resourceGroupName, clusterName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Executes script actions on the specified HDInsight cluster. /// diff --git a/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/ConfigurationsOperations.cs b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/ConfigurationsOperations.cs index 3b13e456b3c80..439dfe2052e96 100644 --- a/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/ConfigurationsOperations.cs +++ b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/ConfigurationsOperations.cs @@ -51,7 +51,199 @@ internal ConfigurationsOperations(HDInsightManagementClient client) public HDInsightManagementClient Client { get; private set; } /// - /// Configures the configuration on the specified cluster. + /// Gets all configuration information for an HDI cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster. + /// + /// + /// 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 resourceGroupName, string clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + 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("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Configures the HTTP settings on the specified cluster. This API is + /// deprecated, please use UpdateGatewaySettings in cluster endpoint instead. /// /// /// The name of the resource group. @@ -71,6 +263,7 @@ internal ConfigurationsOperations(HDInsightManagementClient client) /// /// The cancellation token. /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string configurationName, IDictionary parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request @@ -79,7 +272,9 @@ internal ConfigurationsOperations(HDInsightManagementClient client) } /// - /// The configuration object for the specified cluster. + /// The configuration object for the specified cluster. This API is not + /// recommended and might be removed in the future. Please consider using List + /// configurations API instead. /// /// /// The name of the resource group. @@ -279,7 +474,8 @@ internal ConfigurationsOperations(HDInsightManagementClient client) } /// - /// Configures the configuration on the specified cluster. + /// Configures the HTTP settings on the specified cluster. This API is + /// deprecated, please use UpdateGatewaySettings in cluster endpoint instead. /// /// /// The name of the resource group. @@ -311,6 +507,7 @@ internal ConfigurationsOperations(HDInsightManagementClient client) /// /// A response object containing the response body and response headers. /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] public async Task BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string configurationName, IDictionary parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) diff --git a/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/ConfigurationsOperationsExtensions.cs b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/ConfigurationsOperationsExtensions.cs index 2e84c52b4dbfd..1519ab4147783 100644 --- a/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/ConfigurationsOperationsExtensions.cs +++ b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/ConfigurationsOperationsExtensions.cs @@ -24,7 +24,48 @@ namespace Microsoft.Azure.Management.HDInsight public static partial class ConfigurationsOperationsExtensions { /// - /// Configures the configuration on the specified cluster. + /// Gets all configuration information for an HDI cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster. + /// + public static ClusterConfigurations List(this IConfigurationsOperations operations, string resourceGroupName, string clusterName) + { + return operations.ListAsync(resourceGroupName, clusterName).GetAwaiter().GetResult(); + } + + /// + /// Gets all configuration information for an HDI cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IConfigurationsOperations operations, string resourceGroupName, string clusterName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, clusterName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Configures the HTTP settings on the specified cluster. This API is + /// deprecated, please use UpdateGatewaySettings in cluster endpoint instead. /// /// /// The operations group for this extension method. @@ -41,13 +82,15 @@ public static partial class ConfigurationsOperationsExtensions /// /// The cluster configurations. /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] public static void Update(this IConfigurationsOperations operations, string resourceGroupName, string clusterName, string configurationName, IDictionary parameters) { operations.UpdateAsync(resourceGroupName, clusterName, configurationName, parameters).GetAwaiter().GetResult(); } /// - /// Configures the configuration on the specified cluster. + /// Configures the HTTP settings on the specified cluster. This API is + /// deprecated, please use UpdateGatewaySettings in cluster endpoint instead. /// /// /// The operations group for this extension method. @@ -67,13 +110,16 @@ public static void Update(this IConfigurationsOperations operations, string reso /// /// The cancellation token. /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] public static async Task UpdateAsync(this IConfigurationsOperations operations, string resourceGroupName, string clusterName, string configurationName, IDictionary parameters, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, clusterName, configurationName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// The configuration object for the specified cluster. + /// The configuration object for the specified cluster. This API is not + /// recommended and might be removed in the future. Please consider using List + /// configurations API instead. /// /// /// The operations group for this extension method. @@ -93,7 +139,9 @@ public static IDictionary Get(this IConfigurationsOperations ope } /// - /// The configuration object for the specified cluster. + /// The configuration object for the specified cluster. This API is not + /// recommended and might be removed in the future. Please consider using List + /// configurations API instead. /// /// /// The operations group for this extension method. @@ -119,7 +167,8 @@ public static IDictionary Get(this IConfigurationsOperations ope } /// - /// Configures the configuration on the specified cluster. + /// Configures the HTTP settings on the specified cluster. This API is + /// deprecated, please use UpdateGatewaySettings in cluster endpoint instead. /// /// /// The operations group for this extension method. @@ -136,13 +185,15 @@ public static IDictionary Get(this IConfigurationsOperations ope /// /// The cluster configurations. /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] public static void BeginUpdate(this IConfigurationsOperations operations, string resourceGroupName, string clusterName, string configurationName, IDictionary parameters) { operations.BeginUpdateAsync(resourceGroupName, clusterName, configurationName, parameters).GetAwaiter().GetResult(); } /// - /// Configures the configuration on the specified cluster. + /// Configures the HTTP settings on the specified cluster. This API is + /// deprecated, please use UpdateGatewaySettings in cluster endpoint instead. /// /// /// The operations group for this extension method. @@ -162,6 +213,7 @@ public static void BeginUpdate(this IConfigurationsOperations operations, string /// /// The cancellation token. /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] public static async Task BeginUpdateAsync(this IConfigurationsOperations operations, string resourceGroupName, string clusterName, string configurationName, IDictionary parameters, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, clusterName, configurationName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); diff --git a/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/IClustersOperations.cs b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/IClustersOperations.cs index 2c752772de818..5807eec7055fc 100644 --- a/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/IClustersOperations.cs +++ b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/IClustersOperations.cs @@ -218,6 +218,56 @@ public partial interface IClustersOperations /// Task RotateDiskEncryptionKeyWithHttpMessagesAsync(string resourceGroupName, string clusterName, ClusterDiskEncryptionParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Gets the gateway settings for the specified cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster. + /// + /// + /// 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> GetGatewaySettingsWithHttpMessagesAsync(string resourceGroupName, string clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Configures the gateway settings on the specified cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster. + /// + /// + /// The cluster configurations. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task UpdateGatewaySettingsWithHttpMessagesAsync(string resourceGroupName, string clusterName, UpdateGatewaySettingsParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Executes script actions on the specified HDInsight cluster. /// /// @@ -343,6 +393,31 @@ public partial interface IClustersOperations /// Task BeginRotateDiskEncryptionKeyWithHttpMessagesAsync(string resourceGroupName, string clusterName, ClusterDiskEncryptionParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Configures the gateway settings on the specified cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster. + /// + /// + /// The cluster configurations. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginUpdateGatewaySettingsWithHttpMessagesAsync(string resourceGroupName, string clusterName, UpdateGatewaySettingsParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Executes script actions on the specified HDInsight cluster. /// /// diff --git a/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/IConfigurationsOperations.cs b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/IConfigurationsOperations.cs index 02010191037c9..dce214fb7f09a 100644 --- a/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/IConfigurationsOperations.cs +++ b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/IConfigurationsOperations.cs @@ -24,7 +24,34 @@ namespace Microsoft.Azure.Management.HDInsight public partial interface IConfigurationsOperations { /// - /// Configures the configuration on the specified cluster. + /// Gets all configuration information for an HDI cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster. + /// + /// + /// 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 resourceGroupName, string clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Configures the HTTP settings on the specified cluster. This API is + /// deprecated, please use UpdateGatewaySettings in cluster endpoint + /// instead. /// /// /// The name of the resource group. @@ -47,12 +74,15 @@ public partial interface IConfigurationsOperations /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] Task UpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string configurationName, IDictionary parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// The configuration object for the specified cluster. + /// The configuration object for the specified cluster. This API is not + /// recommended and might be removed in the future. Please consider + /// using List configurations API instead. /// /// /// The name of the resource group. @@ -80,7 +110,9 @@ public partial interface IConfigurationsOperations /// Task>> GetWithHttpMessagesAsync(string resourceGroupName, string clusterName, string configurationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Configures the configuration on the specified cluster. + /// Configures the HTTP settings on the specified cluster. This API is + /// deprecated, please use UpdateGatewaySettings in cluster endpoint + /// instead. /// /// /// The name of the resource group. @@ -103,9 +135,10 @@ public partial interface IConfigurationsOperations /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] Task BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string configurationName, IDictionary parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/Models/ClusterConfigurations.cs b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/Models/ClusterConfigurations.cs new file mode 100644 index 0000000000000..8affd1ef1a5ca --- /dev/null +++ b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/Models/ClusterConfigurations.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HDInsight.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The configuration object for the specified cluster. + /// + public partial class ClusterConfigurations + { + /// + /// Initializes a new instance of the ClusterConfigurations class. + /// + public ClusterConfigurations() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ClusterConfigurations class. + /// + /// The configuration object for the + /// specified configuration for the specified cluster. + public ClusterConfigurations(IDictionary> configurations = default(IDictionary>)) + { + Configurations = configurations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the configuration object for the specified + /// configuration for the specified cluster. + /// + [JsonProperty(PropertyName = "configurations")] + public IDictionary> Configurations { get; set; } + + } +} diff --git a/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/Models/GatewaySettings.cs b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/Models/GatewaySettings.cs new file mode 100644 index 0000000000000..da8ca45ab7124 --- /dev/null +++ b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/Models/GatewaySettings.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.HDInsight.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Gateway settings. + /// + public partial class GatewaySettings + { + /// + /// Initializes a new instance of the GatewaySettings class. + /// + public GatewaySettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GatewaySettings class. + /// + /// Indicates whether or not the + /// gateway settings based authorization is enabled. + /// The gateway settings user name. + /// The gateway settings user password. + public GatewaySettings(string isCredentialEnabled = default(string), string userName = default(string), string password = default(string)) + { + IsCredentialEnabled = isCredentialEnabled; + UserName = userName; + Password = password; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets indicates whether or not the gateway settings based + /// authorization is enabled. + /// + [JsonProperty(PropertyName = "restAuthCredential.isEnabled")] + public string IsCredentialEnabled { get; private set; } + + /// + /// Gets the gateway settings user name. + /// + [JsonProperty(PropertyName = "restAuthCredential.username")] + public string UserName { get; private set; } + + /// + /// Gets the gateway settings user password. + /// + [JsonProperty(PropertyName = "restAuthCredential.password")] + public string Password { get; private set; } + + } +} diff --git a/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/Models/UpdateGatewaySettingsParameters.cs b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/Models/UpdateGatewaySettingsParameters.cs new file mode 100644 index 0000000000000..917c5a640c7fa --- /dev/null +++ b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/Models/UpdateGatewaySettingsParameters.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code 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.HDInsight.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The update gateway settings request parameters. + /// + public partial class UpdateGatewaySettingsParameters + { + /// + /// Initializes a new instance of the UpdateGatewaySettingsParameters + /// class. + /// + public UpdateGatewaySettingsParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateGatewaySettingsParameters + /// class. + /// + /// Indicates whether or not the + /// gateway settings based authorization is enabled. + /// The gateway settings user name. + /// The gateway settings user password. + public UpdateGatewaySettingsParameters(bool? isCredentialEnabled = default(bool?), string userName = default(string), string password = default(string)) + { + IsCredentialEnabled = isCredentialEnabled; + UserName = userName; + Password = password; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether or not the gateway settings based + /// authorization is enabled. + /// + [JsonProperty(PropertyName = "restAuthCredential.isEnabled")] + public bool? IsCredentialEnabled { get; set; } + + /// + /// Gets or sets the gateway settings user name. + /// + [JsonProperty(PropertyName = "restAuthCredential.username")] + public string UserName { get; set; } + + /// + /// Gets or sets the gateway settings user password. + /// + [JsonProperty(PropertyName = "restAuthCredential.password")] + public string Password { get; set; } + + } +} diff --git a/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/SdkInfo_HDInsightManagementClient.cs b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/SdkInfo_HDInsightManagementClient.cs index dded9cc9af053..d0f73eb34694b 100644 --- a/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/SdkInfo_HDInsightManagementClient.cs +++ b/src/SDKs/HDInsight/Management/Management.HDInsight/Generated/SdkInfo_HDInsightManagementClient.cs @@ -30,16 +30,5 @@ public static IEnumerable> ApiInfo_HDInsightManage }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/hdinsight/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=D:\\code\\AzureSDK\\azure-sdk-for-net\\src\\SDKs"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "14f4c33c0a6cc17d0b3577fbddfaacd38a235b57"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } -