diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/CheckNameAvailabilityOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/CheckNameAvailabilityOperations.cs index 28c3e6068754..0d0b71734fcd 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/CheckNameAvailabilityOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/CheckNameAvailabilityOperations.cs @@ -79,6 +79,17 @@ internal CheckNameAvailabilityOperations(PostgreSQLManagementClient client) /// public async Task> ExecuteWithHttpMessagesAsync(NameAvailabilityRequest nameAvailabilityRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -98,7 +109,6 @@ internal CheckNameAvailabilityOperations(PostgreSQLManagementClient client) { nameAvailabilityRequest.Validate(); } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -106,19 +116,18 @@ internal CheckNameAvailabilityOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("nameAvailabilityRequest", nameAvailabilityRequest); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Execute", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DBForPostgreSQL/checkNameAvailability").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DBForPostgreSql/checkNameAvailability").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ConfigurationsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ConfigurationsOperations.cs index 68cafb36067b..c1d594b75c5c 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ConfigurationsOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ConfigurationsOperations.cs @@ -51,7 +51,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) public PostgreSQLManagementClient Client { get; private set; } /// - /// Updates a configuration of a server. + /// List all the configurations in a given server. /// /// /// The name of the resource group. The name is case insensitive. @@ -59,23 +59,220 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) /// /// The name of the server. /// - /// - /// The name of the server configuration. - /// - /// - /// The required parameters for updating a server configuration. - /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string configurationName, Configuration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// 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>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByServer", 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.DBForPostgreSql/flexibleServers/{serverName}/configurations").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + 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 - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, configurationName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + 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; } /// @@ -113,6 +310,17 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) /// public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string configurationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -151,7 +359,6 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "configurationName"); } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -159,7 +366,6 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("configurationName", configurationName); @@ -168,15 +374,15 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/configurations/{configurationName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}/configurations/{configurationName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{configurationName}", System.Uri.EscapeDataString(configurationName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -304,7 +510,35 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) } /// - /// List all the configurations in a given server. + /// Updates a configuration of a server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The name of the server configuration. + /// + /// + /// The required parameters for updating a server configuration. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string configurationName, Configuration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, serverName, configurationName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a configuration of a server. /// /// /// The name of the resource group. The name is case insensitive. @@ -312,6 +546,40 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) /// /// The name of the server. /// + /// + /// The name of the server configuration. + /// + /// + /// The required parameters for updating a server configuration. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> PutWithHttpMessagesAsync(string resourceGroupName, string serverName, string configurationName, Configuration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginPutWithHttpMessagesAsync(resourceGroupName, serverName, configurationName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a configuration of a server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The name of the server configuration. + /// + /// + /// The required parameters for updating a server configuration. + /// /// /// Headers that will be added to request. /// @@ -333,8 +601,19 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string configurationName, Configuration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -369,7 +648,14 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2017-12-01"; + if (configurationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "configurationName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -377,22 +663,24 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); + tracingParameters.Add("configurationName", configurationName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", 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.DBForPostgreSQL/servers/{serverName}/configurations").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}/configurations/{configurationName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{configurationName}", System.Uri.EscapeDataString(configurationName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -401,7 +689,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -432,6 +720,12 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) // 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) { @@ -452,7 +746,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -487,7 +781,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -500,7 +794,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -555,8 +849,19 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string configurationName, Configuration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginPutWithHttpMessagesAsync(string resourceGroupName, string serverName, string configurationName, Configuration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -599,7 +904,6 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -607,25 +911,24 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("configurationName", configurationName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginPut", 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.DBForPostgreSQL/servers/{serverName}/configurations/{configurationName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}/configurations/{configurationName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{configurationName}", System.Uri.EscapeDataString(configurationName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -758,5 +1061,178 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) return _result; } + /// + /// List all the configurations in a given server. + /// + /// + /// 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>> ListByServerNextWithHttpMessagesAsync(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, "ListByServerNext", 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + 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/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ConfigurationsOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ConfigurationsOperationsExtensions.cs index baa28212f649..74e4d7210e1d 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ConfigurationsOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ConfigurationsOperationsExtensions.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.PostgreSQL using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -23,6 +21,92 @@ namespace Microsoft.Azure.Management.PostgreSQL /// public static partial class ConfigurationsOperationsExtensions { + /// + /// List all the configurations in a given server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + public static IPage ListByServer(this IConfigurationsOperations operations, string resourceGroupName, string serverName) + { + return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// List all the configurations in a given server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServerAsync(this IConfigurationsOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets information about a configuration of server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The name of the server configuration. + /// + public static Configuration Get(this IConfigurationsOperations operations, string resourceGroupName, string serverName, string configurationName) + { + return operations.GetAsync(resourceGroupName, serverName, configurationName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about a configuration of server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The name of the server configuration. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IConfigurationsOperations operations, string resourceGroupName, string serverName, string configurationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, configurationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Updates a configuration of a server. /// @@ -41,9 +125,9 @@ public static partial class ConfigurationsOperationsExtensions /// /// The required parameters for updating a server configuration. /// - public static Configuration CreateOrUpdate(this IConfigurationsOperations operations, string resourceGroupName, string serverName, string configurationName, Configuration parameters) + public static Configuration Update(this IConfigurationsOperations operations, string resourceGroupName, string serverName, string configurationName, Configuration parameters) { - return operations.CreateOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serverName, configurationName, parameters).GetAwaiter().GetResult(); } /// @@ -67,16 +151,16 @@ public static Configuration CreateOrUpdate(this IConfigurationsOperations operat /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IConfigurationsOperations operations, string resourceGroupName, string serverName, string configurationName, Configuration parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IConfigurationsOperations operations, string resourceGroupName, string serverName, string configurationName, Configuration parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, configurationName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serverName, configurationName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets information about a configuration of server. + /// Updates a configuration of a server. /// /// /// The operations group for this extension method. @@ -90,13 +174,16 @@ public static Configuration CreateOrUpdate(this IConfigurationsOperations operat /// /// The name of the server configuration. /// - public static Configuration Get(this IConfigurationsOperations operations, string resourceGroupName, string serverName, string configurationName) + /// + /// The required parameters for updating a server configuration. + /// + public static Configuration Put(this IConfigurationsOperations operations, string resourceGroupName, string serverName, string configurationName, Configuration parameters) { - return operations.GetAsync(resourceGroupName, serverName, configurationName).GetAwaiter().GetResult(); + return operations.PutAsync(resourceGroupName, serverName, configurationName, parameters).GetAwaiter().GetResult(); } /// - /// Gets information about a configuration of server. + /// Updates a configuration of a server. /// /// /// The operations group for this extension method. @@ -110,19 +197,22 @@ public static Configuration Get(this IConfigurationsOperations operations, strin /// /// The name of the server configuration. /// + /// + /// The required parameters for updating a server configuration. + /// /// /// The cancellation token. /// - public static async Task GetAsync(this IConfigurationsOperations operations, string resourceGroupName, string serverName, string configurationName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task PutAsync(this IConfigurationsOperations operations, string resourceGroupName, string serverName, string configurationName, Configuration parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, configurationName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.PutWithHttpMessagesAsync(resourceGroupName, serverName, configurationName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// List all the configurations in a given server. + /// Updates a configuration of a server. /// /// /// The operations group for this extension method. @@ -133,13 +223,19 @@ public static Configuration Get(this IConfigurationsOperations operations, strin /// /// The name of the server. /// - public static IEnumerable ListByServer(this IConfigurationsOperations operations, string resourceGroupName, string serverName) + /// + /// The name of the server configuration. + /// + /// + /// The required parameters for updating a server configuration. + /// + public static Configuration BeginUpdate(this IConfigurationsOperations operations, string resourceGroupName, string serverName, string configurationName, Configuration parameters) { - return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + return operations.BeginUpdateAsync(resourceGroupName, serverName, configurationName, parameters).GetAwaiter().GetResult(); } /// - /// List all the configurations in a given server. + /// Updates a configuration of a server. /// /// /// The operations group for this extension method. @@ -150,12 +246,18 @@ public static IEnumerable ListByServer(this IConfigurationsOperat /// /// The name of the server. /// + /// + /// The name of the server configuration. + /// + /// + /// The required parameters for updating a server configuration. + /// /// /// The cancellation token. /// - public static async Task> ListByServerAsync(this IConfigurationsOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginUpdateAsync(this IConfigurationsOperations operations, string resourceGroupName, string serverName, string configurationName, Configuration parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, serverName, configurationName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -179,9 +281,9 @@ public static IEnumerable ListByServer(this IConfigurationsOperat /// /// The required parameters for updating a server configuration. /// - public static Configuration BeginCreateOrUpdate(this IConfigurationsOperations operations, string resourceGroupName, string serverName, string configurationName, Configuration parameters) + public static Configuration BeginPut(this IConfigurationsOperations operations, string resourceGroupName, string serverName, string configurationName, Configuration parameters) { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters).GetAwaiter().GetResult(); + return operations.BeginPutAsync(resourceGroupName, serverName, configurationName, parameters).GetAwaiter().GetResult(); } /// @@ -205,9 +307,43 @@ public static Configuration BeginCreateOrUpdate(this IConfigurationsOperations o /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this IConfigurationsOperations operations, string resourceGroupName, string serverName, string configurationName, Configuration parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginPutAsync(this IConfigurationsOperations operations, string resourceGroupName, string serverName, string configurationName, Configuration parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginPutWithHttpMessagesAsync(resourceGroupName, serverName, configurationName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List all the configurations in a given server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByServerNext(this IConfigurationsOperations operations, string nextPageLink) + { + return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List all the configurations in a given server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServerNextAsync(this IConfigurationsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, configurationName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/DatabasesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/DatabasesOperations.cs index 288e2cf275ea..cfbf9be58b2a 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/DatabasesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/DatabasesOperations.cs @@ -71,10 +71,10 @@ internal DatabasesOperations(PostgreSQLManagementClient client) /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -138,6 +138,17 @@ internal DatabasesOperations(PostgreSQLManagementClient client) /// public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -176,7 +187,6 @@ internal DatabasesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -184,7 +194,6 @@ internal DatabasesOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); @@ -193,15 +202,15 @@ internal DatabasesOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/databases/{databaseName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}/databases/{databaseName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -358,8 +367,19 @@ internal DatabasesOperations(PostgreSQLManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -394,7 +414,6 @@ internal DatabasesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -402,7 +421,6 @@ internal DatabasesOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -410,14 +428,14 @@ internal DatabasesOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/databases").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}/databases").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -512,7 +530,7 @@ internal DatabasesOperations(PostgreSQLManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -580,8 +598,19 @@ internal DatabasesOperations(PostgreSQLManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -624,7 +653,6 @@ internal DatabasesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -632,25 +660,24 @@ internal DatabasesOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", 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.DBForPostgreSQL/servers/{serverName}/databases/{databaseName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}/databases/{databaseName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -833,6 +860,17 @@ internal DatabasesOperations(PostgreSQLManagementClient client) /// public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -871,7 +909,6 @@ internal DatabasesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -879,7 +916,6 @@ internal DatabasesOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); @@ -888,15 +924,15 @@ internal DatabasesOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/databases/{databaseName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}/databases/{databaseName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1005,5 +1041,178 @@ internal DatabasesOperations(PostgreSQLManagementClient client) return _result; } + /// + /// List all the databases in a given server. + /// + /// + /// 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>> ListByServerNextWithHttpMessagesAsync(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, "ListByServerNext", 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + 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/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/DatabasesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/DatabasesOperationsExtensions.cs index f3a1a5e17b8b..7b622f30e6e0 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/DatabasesOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/DatabasesOperationsExtensions.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.PostgreSQL using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -41,9 +39,9 @@ public static partial class DatabasesOperationsExtensions /// /// The required parameters for creating or updating a database. /// - public static Database CreateOrUpdate(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, Database parameters) + public static Database Create(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, Database parameters) { - return operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + return operations.CreateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); } /// @@ -67,9 +65,9 @@ public static Database CreateOrUpdate(this IDatabasesOperations operations, stri /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, Database parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, Database parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -176,7 +174,7 @@ public static Database Get(this IDatabasesOperations operations, string resource /// /// The name of the server. /// - public static IEnumerable ListByServer(this IDatabasesOperations operations, string resourceGroupName, string serverName) + public static IPage ListByServer(this IDatabasesOperations operations, string resourceGroupName, string serverName) { return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); } @@ -196,7 +194,7 @@ public static IEnumerable ListByServer(this IDatabasesOperations opera /// /// The cancellation token. /// - public static async Task> ListByServerAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServerAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) { @@ -222,9 +220,9 @@ public static IEnumerable ListByServer(this IDatabasesOperations opera /// /// The required parameters for creating or updating a database. /// - public static Database BeginCreateOrUpdate(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, Database parameters) + public static Database BeginCreate(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, Database parameters) { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); + return operations.BeginCreateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult(); } /// @@ -248,9 +246,9 @@ public static Database BeginCreateOrUpdate(this IDatabasesOperations operations, /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, Database parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, Database parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -299,5 +297,39 @@ public static void BeginDelete(this IDatabasesOperations operations, string reso (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// List all the databases in a given server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByServerNext(this IDatabasesOperations operations, string nextPageLink) + { + return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List all the databases in a given server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServerNextAsync(this IDatabasesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/FirewallRulesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/FirewallRulesOperations.cs index a3dc237bccb0..41707540e98f 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/FirewallRulesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/FirewallRulesOperations.cs @@ -79,7 +79,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) } /// - /// Deletes a server firewall rule. + /// Deletes a PostgreSQL server firewall rule. /// /// /// The name of the resource group. The name is case insensitive. @@ -104,7 +104,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) } /// - /// Gets information about a server firewall rule. + /// List all the firewall rules in a given server. /// /// /// The name of the resource group. The name is case insensitive. @@ -138,6 +138,17 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) /// public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -176,7 +187,6 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName"); } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -184,7 +194,6 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("firewallRuleName", firewallRuleName); @@ -193,15 +202,15 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}/firewallRules/{firewallRuleName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -329,7 +338,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) } /// - /// List all the firewall rules in a given server. + /// List all the firewall rules in a given PostgreSQL server. /// /// /// The name of the resource group. The name is case insensitive. @@ -358,8 +367,19 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -394,7 +414,6 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -402,7 +421,6 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -410,14 +428,14 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/firewallRules").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}/firewallRules").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -512,7 +530,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -582,6 +600,17 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) /// public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, FirewallRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -628,7 +657,6 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) { parameters.Validate(); } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -636,7 +664,6 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("firewallRuleName", firewallRuleName); @@ -646,15 +673,15 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}/firewallRules/{firewallRuleName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -806,7 +833,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) } /// - /// Deletes a server firewall rule. + /// Deletes a PostgreSQL server firewall rule. /// /// /// The name of the resource group. The name is case insensitive. @@ -837,6 +864,17 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) /// public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -875,7 +913,6 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName"); } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -883,7 +920,6 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("firewallRuleName", firewallRuleName); @@ -892,15 +928,15 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}/firewallRules/{firewallRuleName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1009,5 +1045,178 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) return _result; } + /// + /// List all the firewall rules in a given PostgreSQL server. + /// + /// + /// 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>> ListByServerNextWithHttpMessagesAsync(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, "ListByServerNext", 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + 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/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/FirewallRulesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/FirewallRulesOperationsExtensions.cs index e8caebc5390f..567ecf0ffbba 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/FirewallRulesOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/FirewallRulesOperationsExtensions.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.PostgreSQL using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -76,7 +74,7 @@ public static FirewallRule CreateOrUpdate(this IFirewallRulesOperations operatio } /// - /// Deletes a server firewall rule. + /// Deletes a PostgreSQL server firewall rule. /// /// /// The operations group for this extension method. @@ -96,7 +94,7 @@ public static void Delete(this IFirewallRulesOperations operations, string resou } /// - /// Deletes a server firewall rule. + /// Deletes a PostgreSQL server firewall rule. /// /// /// The operations group for this extension method. @@ -119,7 +117,7 @@ public static void Delete(this IFirewallRulesOperations operations, string resou } /// - /// Gets information about a server firewall rule. + /// List all the firewall rules in a given server. /// /// /// The operations group for this extension method. @@ -139,7 +137,7 @@ public static FirewallRule Get(this IFirewallRulesOperations operations, string } /// - /// Gets information about a server firewall rule. + /// List all the firewall rules in a given server. /// /// /// The operations group for this extension method. @@ -165,7 +163,7 @@ public static FirewallRule Get(this IFirewallRulesOperations operations, string } /// - /// List all the firewall rules in a given server. + /// List all the firewall rules in a given PostgreSQL server. /// /// /// The operations group for this extension method. @@ -176,13 +174,13 @@ public static FirewallRule Get(this IFirewallRulesOperations operations, string /// /// The name of the server. /// - public static IEnumerable ListByServer(this IFirewallRulesOperations operations, string resourceGroupName, string serverName) + public static IPage ListByServer(this IFirewallRulesOperations operations, string resourceGroupName, string serverName) { return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); } /// - /// List all the firewall rules in a given server. + /// List all the firewall rules in a given PostgreSQL server. /// /// /// The operations group for this extension method. @@ -196,7 +194,7 @@ public static IEnumerable ListByServer(this IFirewallRulesOperatio /// /// The cancellation token. /// - public static async Task> ListByServerAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServerAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) { @@ -257,7 +255,7 @@ public static FirewallRule BeginCreateOrUpdate(this IFirewallRulesOperations ope } /// - /// Deletes a server firewall rule. + /// Deletes a PostgreSQL server firewall rule. /// /// /// The operations group for this extension method. @@ -277,7 +275,7 @@ public static void BeginDelete(this IFirewallRulesOperations operations, string } /// - /// Deletes a server firewall rule. + /// Deletes a PostgreSQL server firewall rule. /// /// /// The operations group for this extension method. @@ -299,5 +297,39 @@ public static void BeginDelete(this IFirewallRulesOperations operations, string (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// List all the firewall rules in a given PostgreSQL server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByServerNext(this IFirewallRulesOperations operations, string nextPageLink) + { + return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List all the firewall rules in a given PostgreSQL server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServerNextAsync(this IFirewallRulesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LocationBasedPerformanceTierOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/GetPrivateDnsZoneSuffixOperations.cs similarity index 79% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LocationBasedPerformanceTierOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/GetPrivateDnsZoneSuffixOperations.cs index 5c0729a036d4..cf07ba924257 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LocationBasedPerformanceTierOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/GetPrivateDnsZoneSuffixOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.PostgreSQL using System.Threading.Tasks; /// - /// LocationBasedPerformanceTierOperations operations. + /// GetPrivateDnsZoneSuffixOperations operations. /// - internal partial class LocationBasedPerformanceTierOperations : IServiceOperations, ILocationBasedPerformanceTierOperations + internal partial class GetPrivateDnsZoneSuffixOperations : IServiceOperations, IGetPrivateDnsZoneSuffixOperations { /// - /// Initializes a new instance of the LocationBasedPerformanceTierOperations class. + /// Initializes a new instance of the GetPrivateDnsZoneSuffixOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class LocationBasedPerformanceTierOperations : IServiceOperatio /// /// Thrown when a required parameter is null /// - internal LocationBasedPerformanceTierOperations(PostgreSQLManagementClient client) + internal GetPrivateDnsZoneSuffixOperations(PostgreSQLManagementClient client) { if (client == null) { @@ -51,12 +51,8 @@ internal LocationBasedPerformanceTierOperations(PostgreSQLManagementClient clien public PostgreSQLManagementClient Client { get; private set; } /// - /// List all the performance tiers at specified location in a given - /// subscription. + /// Get private DNS zone suffix in the cloud /// - /// - /// The name of the location. - /// /// /// Headers that will be added to request. /// @@ -78,24 +74,19 @@ internal LocationBasedPerformanceTierOperations(PostgreSQLManagementClient clien /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ExecuteWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (Client.SubscriptionId != null) + if (Client.ApiVersion != null) { - if (Client.SubscriptionId.Length < 1) + if (Client.ApiVersion.Length < 1) { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } } - if (locationName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); - } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -103,20 +94,16 @@ internal LocationBasedPerformanceTierOperations(PostgreSQLManagementClient clien { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("locationName", locationName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Execute", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DBForPostgreSQL/locations/{locationName}/performanceTiers").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.DBForPostgreSql/getPrivateDnsZoneSuffix").ToString(); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -125,7 +112,7 @@ internal LocationBasedPerformanceTierOperations(PostgreSQLManagementClient clien // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -211,7 +198,7 @@ internal LocationBasedPerformanceTierOperations(PostgreSQLManagementClient clien throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -224,7 +211,7 @@ internal LocationBasedPerformanceTierOperations(PostgreSQLManagementClient clien _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/GetPrivateDnsZoneSuffixOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/GetPrivateDnsZoneSuffixOperationsExtensions.cs new file mode 100644 index 000000000000..54c84572bfee --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/GetPrivateDnsZoneSuffixOperationsExtensions.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for GetPrivateDnsZoneSuffixOperations. + /// + public static partial class GetPrivateDnsZoneSuffixOperationsExtensions + { + /// + /// Get private DNS zone suffix in the cloud + /// + /// + /// The operations group for this extension method. + /// + public static string Execute(this IGetPrivateDnsZoneSuffixOperations operations) + { + return operations.ExecuteAsync().GetAwaiter().GetResult(); + } + + /// + /// Get private DNS zone suffix in the cloud + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task ExecuteAsync(this IGetPrivateDnsZoneSuffixOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ExecuteWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IConfigurationsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IConfigurationsOperations.cs index 3aa376678555..a55e219d9a23 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IConfigurationsOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IConfigurationsOperations.cs @@ -23,6 +23,59 @@ namespace Microsoft.Azure.Management.PostgreSQL /// public partial interface IConfigurationsOperations { + /// + /// List all the configurations in a given server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// 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>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets information about a configuration of server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The name of the server configuration. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string configurationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Updates a configuration of a server. /// @@ -53,9 +106,9 @@ public partial interface IConfigurationsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string configurationName, Configuration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string configurationName, Configuration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets information about a configuration of server. + /// Updates a configuration of a server. /// /// /// The name of the resource group. The name is case insensitive. @@ -66,6 +119,9 @@ public partial interface IConfigurationsOperations /// /// The name of the server configuration. /// + /// + /// The required parameters for updating a server configuration. + /// /// /// The headers that will be added to request. /// @@ -81,9 +137,9 @@ public partial interface IConfigurationsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string configurationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> PutWithHttpMessagesAsync(string resourceGroupName, string serverName, string configurationName, Configuration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// List all the configurations in a given server. + /// Updates a configuration of a server. /// /// /// The name of the resource group. The name is case insensitive. @@ -91,6 +147,12 @@ public partial interface IConfigurationsOperations /// /// The name of the server. /// + /// + /// The name of the server configuration. + /// + /// + /// The required parameters for updating a server configuration. + /// /// /// The headers that will be added to request. /// @@ -106,7 +168,7 @@ public partial interface IConfigurationsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string configurationName, Configuration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Updates a configuration of a server. /// @@ -137,6 +199,28 @@ public partial interface IConfigurationsOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string configurationName, Configuration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginPutWithHttpMessagesAsync(string resourceGroupName, string serverName, string configurationName, Configuration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all the configurations in a given server. + /// + /// + /// 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>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IDatabasesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IDatabasesOperations.cs index 51caa9ffa029..4d448be9ac33 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IDatabasesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IDatabasesOperations.cs @@ -53,7 +53,7 @@ public partial interface IDatabasesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a database. /// @@ -131,7 +131,7 @@ public partial interface IDatabasesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates a new database or updates an existing database. /// @@ -162,7 +162,7 @@ public partial interface IDatabasesOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a database. /// @@ -188,5 +188,27 @@ public partial interface IDatabasesOperations /// Thrown when a required parameter is null /// Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all the databases in a given server. + /// + /// + /// 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>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IFirewallRulesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IFirewallRulesOperations.cs index b7d0052b84ba..348bdc9a98d6 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IFirewallRulesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IFirewallRulesOperations.cs @@ -55,7 +55,7 @@ public partial interface IFirewallRulesOperations /// Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, FirewallRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Deletes a server firewall rule. + /// Deletes a PostgreSQL server firewall rule. /// /// /// The name of the resource group. The name is case insensitive. @@ -80,7 +80,7 @@ public partial interface IFirewallRulesOperations /// Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets information about a server firewall rule. + /// List all the firewall rules in a given server. /// /// /// The name of the resource group. The name is case insensitive. @@ -108,7 +108,7 @@ public partial interface IFirewallRulesOperations /// Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// List all the firewall rules in a given server. + /// List all the firewall rules in a given PostgreSQL server. /// /// /// The name of the resource group. The name is case insensitive. @@ -131,7 +131,7 @@ public partial interface IFirewallRulesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates a new firewall rule or updates an existing firewall rule. /// @@ -164,7 +164,7 @@ public partial interface IFirewallRulesOperations /// Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, FirewallRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Deletes a server firewall rule. + /// Deletes a PostgreSQL server firewall rule. /// /// /// The name of the resource group. The name is case insensitive. @@ -188,5 +188,27 @@ public partial interface IFirewallRulesOperations /// Thrown when a required parameter is null /// Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all the firewall rules in a given PostgreSQL server. + /// + /// + /// 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>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ILogFilesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IGetPrivateDnsZoneSuffixOperations.cs similarity index 71% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ILogFilesOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IGetPrivateDnsZoneSuffixOperations.cs index 86dce1f84e0d..11a7818ef68e 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ILogFilesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IGetPrivateDnsZoneSuffixOperations.cs @@ -19,19 +19,13 @@ namespace Microsoft.Azure.Management.PostgreSQL using System.Threading.Tasks; /// - /// LogFilesOperations operations. + /// GetPrivateDnsZoneSuffixOperations operations. /// - public partial interface ILogFilesOperations + public partial interface IGetPrivateDnsZoneSuffixOperations { /// - /// List all the log files in a given server. + /// Get private DNS zone suffix in the cloud /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// /// /// The headers that will be added to request. /// @@ -47,6 +41,6 @@ public partial interface ILogFilesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ExecuteWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ILocationBasedCapabilitiesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ILocationBasedCapabilitiesOperations.cs new file mode 100644 index 000000000000..ffd15a75c28f --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ILocationBasedCapabilitiesOperations.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.PostgreSQL +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// LocationBasedCapabilitiesOperations operations. + /// + public partial interface ILocationBasedCapabilitiesOperations + { + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// The name of the location. + /// + /// + /// 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>> ExecuteWithHttpMessagesAsync(string locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// 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>> ExecuteNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IPostgreSQLManagementClient.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IPostgreSQLManagementClient.cs index 6735268b4da6..f21464fc4868 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IPostgreSQLManagementClient.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IPostgreSQLManagementClient.cs @@ -43,6 +43,11 @@ public partial interface IPostgreSQLManagementClient : System.IDisposable /// ServiceClientCredentials Credentials { get; } + /// + /// The API version to use for this operation. + /// + string ApiVersion { get; } + /// /// The ID of the target subscription. /// @@ -72,75 +77,45 @@ public partial interface IPostgreSQLManagementClient : System.IDisposable /// IServersOperations Servers { get; } - /// - /// Gets the IReplicasOperations. - /// - IReplicasOperations Replicas { get; } - /// /// Gets the IFirewallRulesOperations. /// IFirewallRulesOperations FirewallRules { get; } - /// - /// Gets the IVirtualNetworkRulesOperations. - /// - IVirtualNetworkRulesOperations VirtualNetworkRules { get; } - - /// - /// Gets the IDatabasesOperations. - /// - IDatabasesOperations Databases { get; } - /// /// Gets the IConfigurationsOperations. /// IConfigurationsOperations Configurations { get; } - /// - /// Gets the ILogFilesOperations. - /// - ILogFilesOperations LogFiles { get; } - - /// - /// Gets the IServerAdministratorsOperations. - /// - IServerAdministratorsOperations ServerAdministrators { get; } - - /// - /// Gets the ILocationBasedPerformanceTierOperations. - /// - ILocationBasedPerformanceTierOperations LocationBasedPerformanceTier { get; } - /// /// Gets the ICheckNameAvailabilityOperations. /// ICheckNameAvailabilityOperations CheckNameAvailability { get; } /// - /// Gets the IOperations. + /// Gets the ILocationBasedCapabilitiesOperations. /// - IOperations Operations { get; } + ILocationBasedCapabilitiesOperations LocationBasedCapabilities { get; } /// - /// Gets the IServerSecurityAlertPoliciesOperations. + /// Gets the IVirtualNetworkSubnetUsageOperations. /// - IServerSecurityAlertPoliciesOperations ServerSecurityAlertPolicies { get; } + IVirtualNetworkSubnetUsageOperations VirtualNetworkSubnetUsage { get; } /// - /// Gets the IPrivateEndpointConnectionsOperations. + /// Gets the IOperations. /// - IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } + IOperations Operations { get; } /// - /// Gets the IPrivateLinkResourcesOperations. + /// Gets the IDatabasesOperations. /// - IPrivateLinkResourcesOperations PrivateLinkResources { get; } + IDatabasesOperations Databases { get; } /// - /// Gets the IServerKeysOperations. + /// Gets the IGetPrivateDnsZoneSuffixOperations. /// - IServerKeysOperations ServerKeys { get; } + IGetPrivateDnsZoneSuffixOperations GetPrivateDnsZoneSuffix { get; } } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IPrivateEndpointConnectionsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IPrivateEndpointConnectionsOperations.cs deleted file mode 100644 index f08e2ede0a8e..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IPrivateEndpointConnectionsOperations.cs +++ /dev/null @@ -1,276 +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.PostgreSQL -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateEndpointConnectionsOperations operations. - /// - public partial interface IPrivateEndpointConnectionsOperations - { - /// - /// Gets a private endpoint connection. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates tags on private endpoint connection. - /// - /// - /// Updates private endpoint connection with the specified tags. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// Parameters supplied to the Update private endpoint connection Tags - /// 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string serverName, string privateEndpointConnectionName, TagsObject parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets all private endpoint connections on a server. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// 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>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// - /// - /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates tags on private endpoint connection. - /// - /// - /// Updates private endpoint connection with the specified tags. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// Parameters supplied to the Update private endpoint connection Tags - /// 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> BeginUpdateTagsWithHttpMessagesAsync(string resourceGroupName, string serverName, string privateEndpointConnectionName, TagsObject parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets all private endpoint connections on a server. - /// - /// - /// 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>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IPrivateLinkResourcesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IPrivateLinkResourcesOperations.cs deleted file mode 100644 index 1f1943b06c37..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IPrivateLinkResourcesOperations.cs +++ /dev/null @@ -1,102 +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.PostgreSQL -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateLinkResourcesOperations operations. - /// - public partial interface IPrivateLinkResourcesOperations - { - /// - /// Gets the private link resources for PostgreSQL server. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// 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>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a private link resource for PostgreSQL server. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the private link resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the private link resources for PostgreSQL server. - /// - /// - /// 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>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IReplicasOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IReplicasOperations.cs deleted file mode 100644 index 9a64ff3150b6..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IReplicasOperations.cs +++ /dev/null @@ -1,52 +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.PostgreSQL -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ReplicasOperations operations. - /// - public partial interface IReplicasOperations - { - /// - /// List all the replicas for a given server. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// 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>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerAdministratorsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerAdministratorsOperations.cs deleted file mode 100644 index 1e3c61b5a9db..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerAdministratorsOperations.cs +++ /dev/null @@ -1,183 +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.PostgreSQL -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ServerAdministratorsOperations operations. - /// - public partial interface IServerAdministratorsOperations - { - /// - /// Gets information about a AAD server administrator. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates or update active directory administrator on an existing - /// server. The update action will overwrite the existing - /// administrator. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The required parameters for creating or updating an AAD server - /// administrator. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerAdministratorResource properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes server active directory administrator. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of server Administrators. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// 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 serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates or update active directory administrator on an existing - /// server. The update action will overwrite the existing - /// administrator. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The required parameters for creating or updating an AAD server - /// administrator. - /// - /// - /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerAdministratorResource properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes server active directory administrator. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerKeysOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerKeysOperations.cs deleted file mode 100644 index d7eb0a9635f4..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerKeysOperations.cs +++ /dev/null @@ -1,216 +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.PostgreSQL -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ServerKeysOperations operations. - /// - public partial interface IServerKeysOperations - { - /// - /// Gets a list of Server keys. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// 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 serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a PostgreSQL Server key. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be retrieved. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string keyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates or updates a PostgreSQL Server key. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be operated on (updated or - /// created). - /// - /// - /// The requested PostgreSQL Server key resource state. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string serverName, string keyName, ServerKey parameters, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes the PostgreSQL Server key with the given name. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be deleted. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string serverName, string keyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates or updates a PostgreSQL Server key. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be operated on (updated or - /// created). - /// - /// - /// The requested PostgreSQL Server key resource state. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string serverName, string keyName, ServerKey parameters, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes the PostgreSQL Server key with the given name. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be deleted. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// 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 BeginDeleteWithHttpMessagesAsync(string serverName, string keyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of Server keys. - /// - /// - /// 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/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerSecurityAlertPoliciesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerSecurityAlertPoliciesOperations.cs deleted file mode 100644 index cdfb5c56c6a9..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerSecurityAlertPoliciesOperations.cs +++ /dev/null @@ -1,108 +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.PostgreSQL -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ServerSecurityAlertPoliciesOperations operations. - /// - public partial interface IServerSecurityAlertPoliciesOperations - { - /// - /// Get a server's security alert policy. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates or updates a threat detection policy. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The server security alert policy. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerSecurityAlertPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates or updates a threat detection policy. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The server security alert policy. - /// - /// - /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerSecurityAlertPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServersOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServersOperations.cs index 8d164f836cfc..538ce021fb20 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServersOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServersOperations.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.PostgreSQL public partial interface IServersOperations { /// - /// Creates a new server, or will overwrite an existing server. + /// Creates a new server. /// /// /// The name of the resource group. The name is case insensitive. @@ -50,7 +50,7 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task> CreateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerForCreate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string serverName, Server parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Updates an existing server. The request body can contain one to /// many of the properties present in the normal server definition. @@ -79,7 +79,7 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerForUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a server. /// @@ -148,7 +148,7 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List all the servers in a given subscription. /// @@ -167,7 +167,7 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Restarts a server. /// @@ -177,6 +177,9 @@ public partial interface IServersOperations /// /// The name of the server. /// + /// + /// The parameters for restarting a server. + /// /// /// The headers that will be added to request. /// @@ -189,9 +192,53 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task RestartWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task RestartWithHttpMessagesAsync(string resourceGroupName, string serverName, RestartParameter parameters = default(RestartParameter), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates a new server, or will overwrite an existing server. + /// Starts a server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// 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 StartWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stops a server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// 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 StopWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a new server. /// /// /// The name of the resource group. The name is case insensitive. @@ -217,7 +264,7 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerForCreate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string serverName, Server parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Updates an existing server. The request body can contain one to /// many of the properties present in the normal server definition. @@ -246,7 +293,7 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerForUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a server. /// @@ -278,6 +325,31 @@ public partial interface IServersOperations /// /// The name of the server. /// + /// + /// The parameters for restarting a server. + /// + /// + /// 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 BeginRestartWithHttpMessagesAsync(string resourceGroupName, string serverName, RestartParameter parameters = default(RestartParameter), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts a server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// /// /// The headers that will be added to request. /// @@ -290,6 +362,72 @@ public partial interface IServersOperations /// /// Thrown when a required parameter is null /// - Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginStartWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stops a server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// 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 BeginStopWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all the servers in a given resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all the servers in a given subscription. + /// + /// + /// 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/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IVirtualNetworkRulesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IVirtualNetworkRulesOperations.cs deleted file mode 100644 index 379c985193de..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IVirtualNetworkRulesOperations.cs +++ /dev/null @@ -1,214 +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.PostgreSQL -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// VirtualNetworkRulesOperations operations. - /// - public partial interface IVirtualNetworkRulesOperations - { - /// - /// Gets a virtual network rule. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string virtualNetworkRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates or updates an existing virtual network rule. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - /// - /// The requested virtual Network Rule Resource state. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string virtualNetworkRuleName, VirtualNetworkRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes the virtual network rule with the given name. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string virtualNetworkRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of virtual network rules in a server. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// 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>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates or updates an existing virtual network rule. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - /// - /// The requested virtual Network Rule Resource state. - /// - /// - /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string virtualNetworkRuleName, VirtualNetworkRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes the virtual network rule with the given name. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - /// - /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string virtualNetworkRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of virtual network rules in a server. - /// - /// - /// 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>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ILocationBasedPerformanceTierOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IVirtualNetworkSubnetUsageOperations.cs similarity index 70% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ILocationBasedPerformanceTierOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IVirtualNetworkSubnetUsageOperations.cs index 988819d2e438..ac7226e9094f 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ILocationBasedPerformanceTierOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IVirtualNetworkSubnetUsageOperations.cs @@ -19,17 +19,19 @@ namespace Microsoft.Azure.Management.PostgreSQL using System.Threading.Tasks; /// - /// LocationBasedPerformanceTierOperations operations. + /// VirtualNetworkSubnetUsageOperations operations. /// - public partial interface ILocationBasedPerformanceTierOperations + public partial interface IVirtualNetworkSubnetUsageOperations { /// - /// List all the performance tiers at specified location in a given - /// subscription. + /// Get virtual network subnet usage for a given vNet resource id. /// /// /// The name of the location. /// + /// + /// The required parameters for creating or updating a server. + /// /// /// The headers that will be added to request. /// @@ -45,6 +47,6 @@ public partial interface ILocationBasedPerformanceTierOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ExecuteWithHttpMessagesAsync(string locationName, VirtualNetworkSubnetUsageParameter parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LocationBasedCapabilitiesOperations.cs similarity index 64% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LocationBasedCapabilitiesOperations.cs index 37e18c157e87..c2a5ec05e5a7 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LocationBasedCapabilitiesOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.PostgreSQL using System.Threading.Tasks; /// - /// ServerSecurityAlertPoliciesOperations operations. + /// LocationBasedCapabilitiesOperations operations. /// - internal partial class ServerSecurityAlertPoliciesOperations : IServiceOperations, IServerSecurityAlertPoliciesOperations + internal partial class LocationBasedCapabilitiesOperations : IServiceOperations, ILocationBasedCapabilitiesOperations { /// - /// Initializes a new instance of the ServerSecurityAlertPoliciesOperations class. + /// Initializes a new instance of the LocationBasedCapabilitiesOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class ServerSecurityAlertPoliciesOperations : IServiceOperation /// /// Thrown when a required parameter is null /// - internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client) + internal LocationBasedCapabilitiesOperations(PostgreSQLManagementClient client) { if (client == null) { @@ -51,13 +51,10 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client public PostgreSQLManagementClient Client { get; private set; } /// - /// Get a server's security alert policy. + /// Get capabilities at specified location in a given subscription. /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. + /// + /// The name of the location. /// /// /// Headers that will be added to request. @@ -80,31 +77,19 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ExecuteWithHttpMessagesAsync(string locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (resourceGroupName != null) + if (Client.ApiVersion != null) { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + if (Client.ApiVersion.Length < 1) { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -116,8 +101,10 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); } } - string securityAlertPolicyName = "Default"; - string apiVersion = "2017-12-01"; + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -125,24 +112,19 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("locationName", locationName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Execute", 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.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DBForPostgreSql/locations/{locationName}/capabilities").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -237,7 +219,7 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -250,7 +232,7 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -270,41 +252,10 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client } /// - /// Creates or updates a threat detection policy. + /// Get capabilities at specified location in a given subscription. /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The server security alert policy. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerSecurityAlertPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Creates or updates a threat detection policy. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The server security alert policy. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// Headers that will be added to request. @@ -327,52 +278,12 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerSecurityAlertPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ExecuteNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (parameters == null) + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } - if (parameters != null) - { - parameters.Validate(); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - string securityAlertPolicyName = "Default"; - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -380,26 +291,14 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ExecuteNext", 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.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -407,7 +306,7 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -438,12 +337,6 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client // 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) { @@ -464,7 +357,7 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -499,7 +392,7 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -512,7 +405,7 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LocationBasedCapabilitiesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LocationBasedCapabilitiesOperationsExtensions.cs new file mode 100644 index 000000000000..2c531ea726b6 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LocationBasedCapabilitiesOperationsExtensions.cs @@ -0,0 +1,93 @@ +// +// 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.PostgreSQL +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for LocationBasedCapabilitiesOperations. + /// + public static partial class LocationBasedCapabilitiesOperationsExtensions + { + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the location. + /// + public static IPage Execute(this ILocationBasedCapabilitiesOperations operations, string locationName) + { + return operations.ExecuteAsync(locationName).GetAwaiter().GetResult(); + } + + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the location. + /// + /// + /// The cancellation token. + /// + public static async Task> ExecuteAsync(this ILocationBasedCapabilitiesOperations operations, string locationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ExecuteWithHttpMessagesAsync(locationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ExecuteNext(this ILocationBasedCapabilitiesOperations operations, string nextPageLink) + { + return operations.ExecuteNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ExecuteNextAsync(this ILocationBasedCapabilitiesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ExecuteNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LogFilesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LogFilesOperationsExtensions.cs deleted file mode 100644 index 53640a18d0b3..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LogFilesOperationsExtensions.cs +++ /dev/null @@ -1,67 +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.PostgreSQL -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for LogFilesOperations. - /// - public static partial class LogFilesOperationsExtensions - { - /// - /// List all the log files in a given server. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - public static IEnumerable ListByServer(this ILogFilesOperations operations, string resourceGroupName, string serverName) - { - return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); - } - - /// - /// List all the log files in a given server. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByServerAsync(this ILogFilesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/AzureEntityResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/AzureEntityResource.cs index f2a5a62dd650..1abb92f3a931 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/AzureEntityResource.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/AzureEntityResource.cs @@ -14,9 +14,12 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models using System.Linq; /// - /// The resource model definition for a Azure Resource Manager resource - /// with an etag. + /// Entity Resource /// + /// + /// The resource model definition for an Azure Resource Manager resource + /// with an etag. + /// public partial class AzureEntityResource : Resource { /// @@ -30,12 +33,12 @@ public AzureEntityResource() /// /// Initializes a new instance of the AzureEntityResource class. /// - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// Resource Etag. public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) : base(id, name, type) diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/StorageProfile.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Backup.cs similarity index 50% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/StorageProfile.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Backup.cs index 568db7f42c3b..ad8505597234 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/StorageProfile.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Backup.cs @@ -14,35 +14,33 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models using System.Linq; /// - /// Storage Profile properties of a server + /// Backup properties of a server /// - public partial class StorageProfile + public partial class Backup { /// - /// Initializes a new instance of the StorageProfile class. + /// Initializes a new instance of the Backup class. /// - public StorageProfile() + public Backup() { CustomInit(); } /// - /// Initializes a new instance of the StorageProfile class. + /// Initializes a new instance of the Backup class. /// /// Backup retention days for the /// server. - /// Enable Geo-redundant or not for - /// server backup. Possible values include: 'Enabled', - /// 'Disabled' - /// Max storage allowed for a server. - /// Enable Storage Auto Grow. Possible - /// values include: 'Enabled', 'Disabled' - public StorageProfile(int? backupRetentionDays = default(int?), string geoRedundantBackup = default(string), int? storageMB = default(int?), string storageAutogrow = default(string)) + /// A value indicating whether + /// Geo-Redundant backup is enabled on the server. Possible values + /// include: 'Enabled', 'Disabled' + /// The earliest restore point time + /// (ISO8601 format) for server. + public Backup(int? backupRetentionDays = default(int?), string geoRedundantBackup = default(string), System.DateTime? earliestRestoreDate = default(System.DateTime?)) { BackupRetentionDays = backupRetentionDays; GeoRedundantBackup = geoRedundantBackup; - StorageMB = storageMB; - StorageAutogrow = storageAutogrow; + EarliestRestoreDate = earliestRestoreDate; CustomInit(); } @@ -58,24 +56,18 @@ public StorageProfile() public int? BackupRetentionDays { get; set; } /// - /// Gets or sets enable Geo-redundant or not for server backup. - /// Possible values include: 'Enabled', 'Disabled' + /// Gets or sets a value indicating whether Geo-Redundant backup is + /// enabled on the server. Possible values include: 'Enabled', + /// 'Disabled' /// [JsonProperty(PropertyName = "geoRedundantBackup")] public string GeoRedundantBackup { get; set; } /// - /// Gets or sets max storage allowed for a server. + /// Gets the earliest restore point time (ISO8601 format) for server. /// - [JsonProperty(PropertyName = "storageMB")] - public int? StorageMB { get; set; } - - /// - /// Gets or sets enable Storage Auto Grow. Possible values include: - /// 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "storageAutogrow")] - public string StorageAutogrow { get; set; } + [JsonProperty(PropertyName = "earliestRestoreDate")] + public System.DateTime? EarliestRestoreDate { get; private set; } } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/CapabilityProperties.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/CapabilityProperties.cs new file mode 100644 index 000000000000..1877cb923d59 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/CapabilityProperties.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.PostgreSQL.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Location capabilities. + /// + public partial class CapabilityProperties + { + /// + /// Initializes a new instance of the CapabilityProperties class. + /// + public CapabilityProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CapabilityProperties class. + /// + /// zone name + public CapabilityProperties(string zone = default(string), IList supportedFlexibleServerEditions = default(IList)) + { + Zone = zone; + SupportedFlexibleServerEditions = supportedFlexibleServerEditions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets zone name + /// + [JsonProperty(PropertyName = "zone")] + public string Zone { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "supportedFlexibleServerEditions")] + public IList SupportedFlexibleServerEditions { get; private set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Configuration.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Configuration.cs index e41b79330b4b..9a8bb7dce035 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Configuration.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Configuration.cs @@ -32,21 +32,25 @@ public Configuration() /// /// Initializes a new instance of the Configuration class. /// - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// Value of the configuration. /// Description of the configuration. /// Default value of the /// configuration. - /// Data type of the configuration. + /// Data type of the configuration. Possible + /// values include: 'Boolean', 'Numeric', 'Integer', + /// 'Enumeration' /// Allowed values of the /// configuration. /// Source of the configuration. - public Configuration(string id = default(string), string name = default(string), string type = default(string), string value = default(string), string description = default(string), string defaultValue = default(string), string dataType = default(string), string allowedValues = default(string), string source = default(string)) + /// The system metadata relating to this + /// resource. + public Configuration(string id = default(string), string name = default(string), string type = default(string), string value = default(string), string description = default(string), string defaultValue = default(string), string dataType = default(string), string allowedValues = default(string), string source = default(string), SystemData systemData = default(SystemData)) : base(id, name, type) { Value = value; @@ -55,6 +59,7 @@ public Configuration() DataType = dataType; AllowedValues = allowedValues; Source = source; + SystemData = systemData; CustomInit(); } @@ -82,7 +87,8 @@ public Configuration() public string DefaultValue { get; private set; } /// - /// Gets data type of the configuration. + /// Gets data type of the configuration. Possible values include: + /// 'Boolean', 'Numeric', 'Integer', 'Enumeration' /// [JsonProperty(PropertyName = "properties.dataType")] public string DataType { get; private set; } @@ -99,5 +105,11 @@ public Configuration() [JsonProperty(PropertyName = "properties.source")] public string Source { get; set; } + /// + /// Gets the system metadata relating to this resource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ConfigurationDataType.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ConfigurationDataType.cs new file mode 100644 index 000000000000..5ad7ed9c3539 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ConfigurationDataType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.Models +{ + + /// + /// Defines values for ConfigurationDataType. + /// + public static class ConfigurationDataType + { + public const string Boolean = "Boolean"; + public const string Numeric = "Numeric"; + public const string Integer = "Integer"; + public const string Enumeration = "Enumeration"; + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/CreateMode.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/CreateMode.cs new file mode 100644 index 000000000000..5cf5c2142d16 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/CreateMode.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.Models +{ + + /// + /// Defines values for CreateMode. + /// + public static class CreateMode + { + public const string Default = "Default"; + public const string Create = "Create"; + public const string Update = "Update"; + public const string PointInTimeRestore = "PointInTimeRestore"; + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/IdentityType.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/CreateModeForUpdate.cs similarity index 71% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/IdentityType.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/CreateModeForUpdate.cs index 7825c32e71e4..a794b8334cf3 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/IdentityType.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/CreateModeForUpdate.cs @@ -12,10 +12,11 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models { /// - /// Defines values for IdentityType. + /// Defines values for CreateModeForUpdate. /// - public static class IdentityType + public static class CreateModeForUpdate { - public const string SystemAssigned = "SystemAssigned"; + public const string Default = "Default"; + public const string Update = "Update"; } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkServiceConnectionStateActionsRequire.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/CreatedByType.cs similarity index 61% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkServiceConnectionStateActionsRequire.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/CreatedByType.cs index e1620432e527..06e7fe67c50b 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkServiceConnectionStateActionsRequire.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/CreatedByType.cs @@ -12,10 +12,13 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models { /// - /// Defines values for PrivateLinkServiceConnectionStateActionsRequire. + /// Defines values for CreatedByType. /// - public static class PrivateLinkServiceConnectionStateActionsRequire + public static class CreatedByType { - public const string None = "None"; + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Database.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Database.cs index b27e69c298d5..e202b2b01124 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Database.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Database.cs @@ -32,19 +32,22 @@ public Database() /// /// Initializes a new instance of the Database class. /// - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// The charset of the database. /// The collation of the database. - public Database(string id = default(string), string name = default(string), string type = default(string), string charset = default(string), string collation = default(string)) + /// The system metadata relating to this + /// resource. + public Database(string id = default(string), string name = default(string), string type = default(string), string charset = default(string), string collation = default(string), SystemData systemData = default(SystemData)) : base(id, name, type) { Charset = charset; Collation = collation; + SystemData = systemData; CustomInit(); } @@ -65,5 +68,11 @@ public Database() [JsonProperty(PropertyName = "properties.collation")] public string Collation { get; set; } + /// + /// Gets the system metadata relating to this resource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/DelegatedSubnetUsage.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/DelegatedSubnetUsage.cs new file mode 100644 index 000000000000..c0b0fface6fa --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/DelegatedSubnetUsage.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.PostgreSQL.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Delegated subnet usage data. + /// + public partial class DelegatedSubnetUsage + { + /// + /// Initializes a new instance of the DelegatedSubnetUsage class. + /// + public DelegatedSubnetUsage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DelegatedSubnetUsage class. + /// + /// name of the subnet + /// Number of used delegated subnets + public DelegatedSubnetUsage(string subnetName = default(string), long? usage = default(long?)) + { + SubnetName = subnetName; + Usage = usage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets name of the subnet + /// + [JsonProperty(PropertyName = "subnetName")] + public string SubnetName { get; private set; } + + /// + /// Gets number of used delegated subnets + /// + [JsonProperty(PropertyName = "usage")] + public long? Usage { get; private set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ErrorResponse.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ErrorResponse.cs index 83a64fe68701..ce53d2e316be 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ErrorResponse.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ErrorResponse.cs @@ -16,8 +16,13 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models using System.Linq; /// - /// The resource management error response. + /// Error Response /// + /// + /// Common error response for all Azure Resource Manager APIs to return + /// error details for failed operations. (This also follows the OData error + /// response format.) + /// public partial class ErrorResponse { /// diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/FirewallRule.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/FirewallRule.cs index 5603a81676a6..96a0d71c52e0 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/FirewallRule.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/FirewallRule.cs @@ -36,17 +36,20 @@ public FirewallRule() /// firewall rule. Must be IPv4 format. /// The end IP address of the server /// firewall rule. Must be IPv4 format. - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. - public FirewallRule(string startIpAddress, string endIpAddress, string id = default(string), string name = default(string), string type = default(string)) + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// The system metadata relating to this + /// resource. + public FirewallRule(string startIpAddress, string endIpAddress, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) : base(id, name, type) { StartIpAddress = startIpAddress; EndIpAddress = endIpAddress; + SystemData = systemData; CustomInit(); } @@ -69,6 +72,12 @@ public FirewallRule() [JsonProperty(PropertyName = "properties.endIpAddress")] public string EndIpAddress { get; set; } + /// + /// Gets the system metadata relating to this resource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + /// /// Validate the object. /// diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/GeoRedundantBackup.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/GeoRedundantBackupEnum.cs similarity index 85% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/GeoRedundantBackup.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/GeoRedundantBackupEnum.cs index d99e336f99df..68ea4e021bcb 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/GeoRedundantBackup.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/GeoRedundantBackupEnum.cs @@ -12,9 +12,9 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models { /// - /// Defines values for GeoRedundantBackup. + /// Defines values for GeoRedundantBackupEnum. /// - public static class GeoRedundantBackup + public static class GeoRedundantBackupEnum { public const string Enabled = "Enabled"; public const string Disabled = "Disabled"; diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/HighAvailability.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/HighAvailability.cs new file mode 100644 index 000000000000..e870572aefc4 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/HighAvailability.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// High availability properties of a server + /// + public partial class HighAvailability + { + /// + /// Initializes a new instance of the HighAvailability class. + /// + public HighAvailability() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HighAvailability class. + /// + /// The HA mode for the server. Possible values + /// include: 'Disabled', 'ZoneRedundant' + /// A state of a HA server that is visible to user. + /// Possible values include: 'NotEnabled', 'CreatingStandby', + /// 'ReplicatingData', 'FailingOver', 'Healthy', + /// 'RemovingStandby' + /// availability zone information + /// of the standby. + public HighAvailability(string mode = default(string), string state = default(string), string standbyAvailabilityZone = default(string)) + { + Mode = mode; + State = state; + StandbyAvailabilityZone = standbyAvailabilityZone; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the HA mode for the server. Possible values include: + /// 'Disabled', 'ZoneRedundant' + /// + [JsonProperty(PropertyName = "mode")] + public string Mode { get; set; } + + /// + /// Gets a state of a HA server that is visible to user. Possible + /// values include: 'NotEnabled', 'CreatingStandby', 'ReplicatingData', + /// 'FailingOver', 'Healthy', 'RemovingStandby' + /// + [JsonProperty(PropertyName = "state")] + public string State { get; private set; } + + /// + /// Gets availability zone information of the standby. + /// + [JsonProperty(PropertyName = "standbyAvailabilityZone")] + public string StandbyAvailabilityZone { get; private set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PublicNetworkAccessEnum.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/HighAvailabilityMode.cs similarity index 76% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PublicNetworkAccessEnum.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/HighAvailabilityMode.cs index 304db450b0c4..4ee8dd69dc47 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PublicNetworkAccessEnum.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/HighAvailabilityMode.cs @@ -12,11 +12,11 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models { /// - /// Defines values for PublicNetworkAccessEnum. + /// Defines values for HighAvailabilityMode. /// - public static class PublicNetworkAccessEnum + public static class HighAvailabilityMode { - public const string Enabled = "Enabled"; public const string Disabled = "Disabled"; + public const string ZoneRedundant = "ZoneRedundant"; } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Identity.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Identity.cs new file mode 100644 index 000000000000..988b87178548 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Identity.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Identity for the resource. + /// + public partial class Identity + { + /// + /// Initializes a new instance of the Identity class. + /// + public Identity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Identity class. + /// + /// The principal ID of resource + /// identity. + /// The tenant ID of resource. + /// The identity type. Possible values include: + /// 'SystemAssigned' + public Identity(string principalId = default(string), string tenantId = default(string), ResourceIdentityType? type = default(ResourceIdentityType?)) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal ID of resource identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the tenant ID of resource. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets or sets the identity type. Possible values include: + /// 'SystemAssigned' + /// + [JsonProperty(PropertyName = "type")] + public ResourceIdentityType? Type { get; set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/LogFile.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/LogFile.cs deleted file mode 100644 index f2d928126710..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/LogFile.cs +++ /dev/null @@ -1,95 +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.PostgreSQL.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a log file. - /// - [Rest.Serialization.JsonTransformation] - public partial class LogFile : ProxyResource - { - /// - /// Initializes a new instance of the LogFile class. - /// - public LogFile() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LogFile class. - /// - /// Fully qualified resource Id for the resource. Ex - - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. - /// Size of the log file. - /// Creation timestamp of the log - /// file. - /// Last modified timestamp of the log - /// file. - /// Type of the log file. - /// The url to download the log file from. - public LogFile(string id = default(string), string name = default(string), string type = default(string), long? sizeInKB = default(long?), System.DateTime? createdTime = default(System.DateTime?), System.DateTime? lastModifiedTime = default(System.DateTime?), string logFileType = default(string), string url = default(string)) - : base(id, name, type) - { - SizeInKB = sizeInKB; - CreatedTime = createdTime; - LastModifiedTime = lastModifiedTime; - LogFileType = logFileType; - Url = url; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets size of the log file. - /// - [JsonProperty(PropertyName = "properties.sizeInKB")] - public long? SizeInKB { get; set; } - - /// - /// Gets creation timestamp of the log file. - /// - [JsonProperty(PropertyName = "properties.createdTime")] - public System.DateTime? CreatedTime { get; private set; } - - /// - /// Gets last modified timestamp of the log file. - /// - [JsonProperty(PropertyName = "properties.lastModifiedTime")] - public System.DateTime? LastModifiedTime { get; private set; } - - /// - /// Gets or sets type of the log file. - /// - [JsonProperty(PropertyName = "properties.type")] - public string LogFileType { get; set; } - - /// - /// Gets or sets the url to download the log file from. - /// - [JsonProperty(PropertyName = "properties.url")] - public string Url { get; set; } - - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/MaintenanceWindow.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/MaintenanceWindow.cs new file mode 100644 index 000000000000..a1bd99d71c34 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/MaintenanceWindow.cs @@ -0,0 +1,77 @@ +// +// 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.PostgreSQL.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Maintenance window properties of a server. + /// + public partial class MaintenanceWindow + { + /// + /// Initializes a new instance of the MaintenanceWindow class. + /// + public MaintenanceWindow() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MaintenanceWindow class. + /// + /// indicates whether custom window is + /// enabled or disabled + /// start hour for maintenance window + /// start minute for maintenance + /// window + /// day of week for maintenance window + public MaintenanceWindow(string customWindow = default(string), int? startHour = default(int?), int? startMinute = default(int?), int? dayOfWeek = default(int?)) + { + CustomWindow = customWindow; + StartHour = startHour; + StartMinute = startMinute; + DayOfWeek = dayOfWeek; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether custom window is enabled or disabled + /// + [JsonProperty(PropertyName = "customWindow")] + public string CustomWindow { get; set; } + + /// + /// Gets or sets start hour for maintenance window + /// + [JsonProperty(PropertyName = "startHour")] + public int? StartHour { get; set; } + + /// + /// Gets or sets start minute for maintenance window + /// + [JsonProperty(PropertyName = "startMinute")] + public int? StartMinute { get; set; } + + /// + /// Gets or sets day of week for maintenance window + /// + [JsonProperty(PropertyName = "dayOfWeek")] + public int? DayOfWeek { get; set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/MinimalTlsVersionEnum.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/MinimalTlsVersionEnum.cs deleted file mode 100644 index 2652830dff36..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/MinimalTlsVersionEnum.cs +++ /dev/null @@ -1,24 +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.PostgreSQL.Models -{ - - /// - /// Defines values for MinimalTlsVersionEnum. - /// - public static class MinimalTlsVersionEnum - { - public const string TLS10 = "TLS1_0"; - public const string TLS11 = "TLS1_1"; - public const string TLS12 = "TLS1_2"; - public const string TLSEnforcementDisabled = "TLSEnforcementDisabled"; - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/NameAvailability.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/NameAvailability.cs index 5b95c7470407..18e539dc6fca 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/NameAvailability.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/NameAvailability.cs @@ -32,12 +32,14 @@ public NameAvailability() /// Error Message. /// Indicates whether the resource name is /// available. - /// Reason for name being unavailable. - public NameAvailability(string message = default(string), bool? nameAvailable = default(bool?), string reason = default(string)) + /// name of the PostgreSQL server. + /// type of the server + public NameAvailability(string message = default(string), bool? nameAvailable = default(bool?), string name = default(string), string type = default(string)) { Message = message; NameAvailable = nameAvailable; - Reason = reason; + Name = name; + Type = type; CustomInit(); } @@ -59,10 +61,16 @@ public NameAvailability() public bool? NameAvailable { get; set; } /// - /// Gets or sets reason for name being unavailable. + /// Gets or sets name of the PostgreSQL server. /// - [JsonProperty(PropertyName = "reason")] - public string Reason { get; set; } + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets type of the server + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Network.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Network.cs new file mode 100644 index 000000000000..bd8f270df8fb --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Network.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.PostgreSQL.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Network properties of a server + /// + public partial class Network + { + /// + /// Initializes a new instance of the Network class. + /// + public Network() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Network class. + /// + /// public network access is enabled + /// or not. Possible values include: 'Enabled', 'Disabled' + /// delegated subnet arm + /// resource id. + /// private dns zone arm + /// resource id. + public Network(string publicNetworkAccess = default(string), string delegatedSubnetResourceId = default(string), string privateDnsZoneArmResourceId = default(string)) + { + PublicNetworkAccess = publicNetworkAccess; + DelegatedSubnetResourceId = delegatedSubnetResourceId; + PrivateDnsZoneArmResourceId = privateDnsZoneArmResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets public network access is enabled or not. Possible values + /// include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "publicNetworkAccess")] + public string PublicNetworkAccess { get; private set; } + + /// + /// Gets or sets delegated subnet arm resource id. + /// + [JsonProperty(PropertyName = "delegatedSubnetResourceId")] + public string DelegatedSubnetResourceId { get; set; } + + /// + /// Gets or sets private dns zone arm resource id. + /// + [JsonProperty(PropertyName = "privateDnsZoneArmResourceId")] + public string PrivateDnsZoneArmResourceId { get; set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Operation.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Operation.cs index a8745f34b9b5..2c60178e4ca3 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Operation.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Operation.cs @@ -35,14 +35,17 @@ public Operation() /// this particular object. /// The localized display information for this /// particular operation or action. + /// Indicates whether the operation is a + /// data action /// The intended executor of the operation. /// Possible values include: 'NotSpecified', 'user', 'system' /// Additional descriptions for the /// operation. - public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay), string origin = default(string), IDictionary properties = default(IDictionary)) + public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay), bool? isDataAction = default(bool?), string origin = default(string), IDictionary properties = default(IDictionary)) { Name = name; Display = display; + IsDataAction = isDataAction; Origin = origin; Properties = properties; CustomInit(); @@ -67,6 +70,12 @@ public Operation() [JsonProperty(PropertyName = "display")] public OperationDisplay Display { get; private set; } + /// + /// Gets or sets indicates whether the operation is a data action + /// + [JsonProperty(PropertyName = "isDataAction")] + public bool? IsDataAction { get; set; } + /// /// Gets the intended executor of the operation. Possible values /// include: 'NotSpecified', 'user', 'system' diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/OperationListResult.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/OperationListResult.cs index 2214d41266c9..97415a8f71dd 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/OperationListResult.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/OperationListResult.cs @@ -31,11 +31,15 @@ public OperationListResult() /// /// Initializes a new instance of the OperationListResult class. /// - /// The list of resource provider - /// operations. - public OperationListResult(IList value = default(IList)) + /// Collection of available operation + /// details + /// URL client should use to fetch the next page + /// (per server side paging). + /// It's null for now, added for future use. + public OperationListResult(IList value = default(IList), string nextLink = default(string)) { Value = value; + NextLink = nextLink; CustomInit(); } @@ -45,10 +49,18 @@ public OperationListResult() partial void CustomInit(); /// - /// Gets or sets the list of resource provider operations. + /// Gets or sets collection of available operation details /// [JsonProperty(PropertyName = "value")] public IList Value { get; set; } + /// + /// Gets or sets URL client should use to fetch the next page (per + /// server side paging). + /// It's null for now, added for future use. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Page.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Page.cs index e2aaaf1cc4c6..b2e48cb18317 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Page.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Page.cs @@ -26,7 +26,7 @@ public class Page : IPage /// /// Gets the link to the next page. /// - [JsonProperty("")] + [JsonProperty("nextLink")] public string NextPageLink { get; private set; } [JsonProperty("value")] diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Page1.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Page1.cs deleted file mode 100644 index b37401d6f592..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Page1.cs +++ /dev/null @@ -1,53 +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.PostgreSQL.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - - /// - /// Defines a page in Azure responses. - /// - /// Type of the page content items - [JsonObject] - public class Page1 : IPage - { - /// - /// Gets the link to the next page. - /// - [JsonProperty("nextLink")] - public string NextPageLink { get; private set; } - - [JsonProperty("value")] - private IList Items{ get; set; } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// A an enumerator that can be used to iterate through the collection. - public IEnumerator GetEnumerator() - { - return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); - } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// A an enumerator that can be used to iterate through the collection. - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PerformanceTierProperties.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PerformanceTierProperties.cs deleted file mode 100644 index 586af9432419..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PerformanceTierProperties.cs +++ /dev/null @@ -1,63 +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.PostgreSQL.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Performance tier properties - /// - public partial class PerformanceTierProperties - { - /// - /// Initializes a new instance of the PerformanceTierProperties class. - /// - public PerformanceTierProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the PerformanceTierProperties class. - /// - /// ID of the performance tier. - /// Service level objectives - /// associated with the performance tier - public PerformanceTierProperties(string id = default(string), IList serviceLevelObjectives = default(IList)) - { - Id = id; - ServiceLevelObjectives = serviceLevelObjectives; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets ID of the performance tier. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets service level objectives associated with the - /// performance tier - /// - [JsonProperty(PropertyName = "serviceLevelObjectives")] - public IList ServiceLevelObjectives { get; set; } - - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PerformanceTierServiceLevelObjectives.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PerformanceTierServiceLevelObjectives.cs deleted file mode 100644 index 8a28c987ff9e..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PerformanceTierServiceLevelObjectives.cs +++ /dev/null @@ -1,118 +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.PostgreSQL.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Service level objectives for performance tier. - /// - public partial class PerformanceTierServiceLevelObjectives - { - /// - /// Initializes a new instance of the - /// PerformanceTierServiceLevelObjectives class. - /// - public PerformanceTierServiceLevelObjectives() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// PerformanceTierServiceLevelObjectives class. - /// - /// ID for the service level objective. - /// Edition of the performance tier. - /// vCore associated with the service level - /// objective - /// Hardware generation associated - /// with the service level objective - /// Maximum Backup retention in - /// days for the performance tier edition - /// Minimum Backup retention in - /// days for the performance tier edition - /// Max storage allowed for a - /// server. - /// Max storage allowed for a - /// server. - public PerformanceTierServiceLevelObjectives(string id = default(string), string edition = default(string), int? vCore = default(int?), string hardwareGeneration = default(string), int? maxBackupRetentionDays = default(int?), int? minBackupRetentionDays = default(int?), int? maxStorageMB = default(int?), int? minStorageMB = default(int?)) - { - Id = id; - Edition = edition; - VCore = vCore; - HardwareGeneration = hardwareGeneration; - MaxBackupRetentionDays = maxBackupRetentionDays; - MinBackupRetentionDays = minBackupRetentionDays; - MaxStorageMB = maxStorageMB; - MinStorageMB = minStorageMB; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets ID for the service level objective. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets edition of the performance tier. - /// - [JsonProperty(PropertyName = "edition")] - public string Edition { get; set; } - - /// - /// Gets or sets vCore associated with the service level objective - /// - [JsonProperty(PropertyName = "vCore")] - public int? VCore { get; set; } - - /// - /// Gets or sets hardware generation associated with the service level - /// objective - /// - [JsonProperty(PropertyName = "hardwareGeneration")] - public string HardwareGeneration { get; set; } - - /// - /// Gets or sets maximum Backup retention in days for the performance - /// tier edition - /// - [JsonProperty(PropertyName = "maxBackupRetentionDays")] - public int? MaxBackupRetentionDays { get; set; } - - /// - /// Gets or sets minimum Backup retention in days for the performance - /// tier edition - /// - [JsonProperty(PropertyName = "minBackupRetentionDays")] - public int? MinBackupRetentionDays { get; set; } - - /// - /// Gets or sets max storage allowed for a server. - /// - [JsonProperty(PropertyName = "maxStorageMB")] - public int? MaxStorageMB { get; set; } - - /// - /// Gets or sets max storage allowed for a server. - /// - [JsonProperty(PropertyName = "minStorageMB")] - public int? MinStorageMB { get; set; } - - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Plan.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Plan.cs new file mode 100644 index 000000000000..7b64c41e346f --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Plan.cs @@ -0,0 +1,116 @@ +// +// 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.PostgreSQL.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Plan for the resource. + /// + public partial class Plan + { + /// + /// Initializes a new instance of the Plan class. + /// + public Plan() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Plan class. + /// + /// A user defined name of the 3rd Party Artifact + /// that is being procured. + /// The publisher of the 3rd Party Artifact + /// that is being bought. E.g. NewRelic + /// The 3rd Party artifact that is being + /// procured. E.g. NewRelic. Product maps to the OfferID specified for + /// the artifact at the time of Data Market onboarding. + /// A publisher provided promotion code as + /// provisioned in Data Market for the said product/artifact. + /// The version of the desired + /// product/artifact. + public Plan(string name, string publisher, string product, string promotionCode = default(string), string version = default(string)) + { + Name = name; + Publisher = publisher; + Product = product; + PromotionCode = promotionCode; + Version = version; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a user defined name of the 3rd Party Artifact that is + /// being procured. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the publisher of the 3rd Party Artifact that is being + /// bought. E.g. NewRelic + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets the 3rd Party artifact that is being procured. E.g. + /// NewRelic. Product maps to the OfferID specified for the artifact at + /// the time of Data Market onboarding. + /// + [JsonProperty(PropertyName = "product")] + public string Product { get; set; } + + /// + /// Gets or sets a publisher provided promotion code as provisioned in + /// Data Market for the said product/artifact. + /// + [JsonProperty(PropertyName = "promotionCode")] + public string PromotionCode { get; set; } + + /// + /// Gets or sets the version of the desired product/artifact. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Publisher == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Publisher"); + } + if (Product == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Product"); + } + } + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateEndpointConnection.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateEndpointConnection.cs deleted file mode 100644 index d0f5e74f37c6..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateEndpointConnection.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.PostgreSQL.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// A private endpoint connection - /// - [Rest.Serialization.JsonTransformation] - public partial class PrivateEndpointConnection : ProxyResource - { - /// - /// Initializes a new instance of the PrivateEndpointConnection class. - /// - public PrivateEndpointConnection() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the PrivateEndpointConnection class. - /// - /// Fully qualified resource Id for the resource. Ex - - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. - /// Private endpoint which the connection - /// belongs to. - /// Connection state of - /// the private endpoint connection. - /// State of the private endpoint - /// connection. - public PrivateEndpointConnection(string id = default(string), string name = default(string), string type = default(string), PrivateEndpointProperty privateEndpoint = default(PrivateEndpointProperty), PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionStateProperty), string provisioningState = default(string)) - : base(id, name, type) - { - PrivateEndpoint = privateEndpoint; - PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; - ProvisioningState = provisioningState; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets private endpoint which the connection belongs to. - /// - [JsonProperty(PropertyName = "properties.privateEndpoint")] - public PrivateEndpointProperty PrivateEndpoint { get; set; } - - /// - /// Gets or sets connection state of the private endpoint connection. - /// - [JsonProperty(PropertyName = "properties.privateLinkServiceConnectionState")] - public PrivateLinkServiceConnectionStateProperty PrivateLinkServiceConnectionState { get; set; } - - /// - /// Gets state of the private endpoint connection. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (PrivateLinkServiceConnectionState != null) - { - PrivateLinkServiceConnectionState.Validate(); - } - } - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateEndpointProvisioningState.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateEndpointProvisioningState.cs deleted file mode 100644 index f00516eae044..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateEndpointProvisioningState.cs +++ /dev/null @@ -1,25 +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.PostgreSQL.Models -{ - - /// - /// Defines values for PrivateEndpointProvisioningState. - /// - public static class PrivateEndpointProvisioningState - { - public const string Approving = "Approving"; - public const string Ready = "Ready"; - public const string Dropping = "Dropping"; - public const string Failed = "Failed"; - public const string Rejecting = "Rejecting"; - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkResource.cs deleted file mode 100644 index d6071c15d6c7..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkResource.cs +++ /dev/null @@ -1,59 +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.PostgreSQL.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A private link resource - /// - public partial class PrivateLinkResource : ProxyResource - { - /// - /// Initializes a new instance of the PrivateLinkResource class. - /// - public PrivateLinkResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the PrivateLinkResource class. - /// - /// Fully qualified resource Id for the resource. Ex - - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. - /// The private link resource group - /// id. - public PrivateLinkResource(string id = default(string), string name = default(string), string type = default(string), PrivateLinkResourceProperties properties = default(PrivateLinkResourceProperties)) - : base(id, name, type) - { - Properties = properties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the private link resource group id. - /// - [JsonProperty(PropertyName = "properties")] - public PrivateLinkResourceProperties Properties { get; private set; } - - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkResourceProperties.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkResourceProperties.cs deleted file mode 100644 index 6760ae16c1ce..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkResourceProperties.cs +++ /dev/null @@ -1,64 +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.PostgreSQL.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Properties of a private link resource. - /// - public partial class PrivateLinkResourceProperties - { - /// - /// Initializes a new instance of the PrivateLinkResourceProperties - /// class. - /// - public PrivateLinkResourceProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the PrivateLinkResourceProperties - /// class. - /// - /// The private link resource group id. - /// The private link resource required - /// member names. - public PrivateLinkResourceProperties(string groupId = default(string), IList requiredMembers = default(IList)) - { - GroupId = groupId; - RequiredMembers = requiredMembers; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the private link resource group id. - /// - [JsonProperty(PropertyName = "groupId")] - public string GroupId { get; private set; } - - /// - /// Gets the private link resource required member names. - /// - [JsonProperty(PropertyName = "requiredMembers")] - public IList RequiredMembers { get; private set; } - - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs deleted file mode 100644 index feab0c488c4c..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs +++ /dev/null @@ -1,87 +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.PostgreSQL.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - public partial class PrivateLinkServiceConnectionStateProperty - { - /// - /// Initializes a new instance of the - /// PrivateLinkServiceConnectionStateProperty class. - /// - public PrivateLinkServiceConnectionStateProperty() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// PrivateLinkServiceConnectionStateProperty class. - /// - /// The private link service connection - /// status. - /// The private link service connection - /// description. - /// The actions required for private link - /// service connection. - public PrivateLinkServiceConnectionStateProperty(string status, string description, string actionsRequired = default(string)) - { - Status = status; - Description = description; - ActionsRequired = actionsRequired; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the private link service connection status. - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } - - /// - /// Gets or sets the private link service connection description. - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - - /// - /// Gets the actions required for private link service connection. - /// - [JsonProperty(PropertyName = "actionsRequired")] - public string ActionsRequired { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Status == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Status"); - } - if (Description == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Description"); - } - } - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkServiceConnectionStateStatus.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkServiceConnectionStateStatus.cs deleted file mode 100644 index c9992315e6d0..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkServiceConnectionStateStatus.cs +++ /dev/null @@ -1,24 +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.PostgreSQL.Models -{ - - /// - /// Defines values for PrivateLinkServiceConnectionStateStatus. - /// - public static class PrivateLinkServiceConnectionStateStatus - { - public const string Approved = "Approved"; - public const string Pending = "Pending"; - public const string Rejected = "Rejected"; - public const string Disconnected = "Disconnected"; - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ProxyResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ProxyResource.cs index 221808691947..11683104e844 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ProxyResource.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ProxyResource.cs @@ -13,9 +13,12 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models using System.Linq; /// - /// The resource model definition for a ARM proxy resource. It will have - /// everything other than required location and tags + /// Proxy Resource /// + /// + /// The resource model definition for a Azure Resource Manager proxy + /// resource. It will not have tags and a location + /// public partial class ProxyResource : Resource { /// @@ -29,12 +32,12 @@ public ProxyResource() /// /// Initializes a new instance of the ProxyResource class. /// - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) : base(id, name, type) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Resource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Resource.cs index 00ee8d855eb5..cbfe68d84772 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Resource.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Resource.cs @@ -15,6 +15,13 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models using Newtonsoft.Json; using System.Linq; + /// + /// Resource + /// + /// + /// Common fields that are returned in the response for all Azure Resource + /// Manager resources + /// public partial class Resource : IResource { /// @@ -28,12 +35,12 @@ public Resource() /// /// Initializes a new instance of the Resource class. /// - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" public Resource(string id = default(string), string name = default(string), string type = default(string)) { Id = id; @@ -48,7 +55,7 @@ public Resource() partial void CustomInit(); /// - /// Gets fully qualified resource Id for the resource. Ex - + /// Gets fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// [JsonProperty(PropertyName = "id")] @@ -61,9 +68,9 @@ public Resource() public string Name { get; private set; } /// - /// Gets the type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// Gets the type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// [JsonProperty(PropertyName = "type")] public string Type { get; private set; } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ResourceIdentity.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ResourceIdentity.cs deleted file mode 100644 index 01acfc21d827..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ResourceIdentity.cs +++ /dev/null @@ -1,75 +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.PostgreSQL.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Azure Active Directory identity configuration for a resource. - /// - public partial class ResourceIdentity - { - /// - /// Initializes a new instance of the ResourceIdentity class. - /// - public ResourceIdentity() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ResourceIdentity class. - /// - /// The Azure Active Directory principal - /// id. - /// The identity type. Set this to 'SystemAssigned' - /// in order to automatically create and assign an Azure Active - /// Directory principal for the resource. Possible values include: - /// 'SystemAssigned' - /// The Azure Active Directory tenant - /// id. - public ResourceIdentity(System.Guid? principalId = default(System.Guid?), string type = default(string), System.Guid? tenantId = default(System.Guid?)) - { - PrincipalId = principalId; - Type = type; - TenantId = tenantId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the Azure Active Directory principal id. - /// - [JsonProperty(PropertyName = "principalId")] - public System.Guid? PrincipalId { get; private set; } - - /// - /// Gets or sets the identity type. Set this to 'SystemAssigned' in - /// order to automatically create and assign an Azure Active Directory - /// principal for the resource. Possible values include: - /// 'SystemAssigned' - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets the Azure Active Directory tenant id. - /// - [JsonProperty(PropertyName = "tenantId")] - public System.Guid? TenantId { get; private set; } - - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ResourceIdentityType.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ResourceIdentityType.cs new file mode 100644 index 000000000000..d41744d6485d --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ResourceIdentityType.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ResourceIdentityType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ResourceIdentityType + { + [EnumMember(Value = "SystemAssigned")] + SystemAssigned + } + internal static class ResourceIdentityTypeEnumExtension + { + internal static string ToSerializedValue(this ResourceIdentityType? value) + { + return value == null ? null : ((ResourceIdentityType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ResourceIdentityType value) + { + switch( value ) + { + case ResourceIdentityType.SystemAssigned: + return "SystemAssigned"; + } + return null; + } + + internal static ResourceIdentityType? ParseResourceIdentityType(this string value) + { + switch( value ) + { + case "SystemAssigned": + return ResourceIdentityType.SystemAssigned; + } + return null; + } + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ResourceModelWithAllowedPropertySet.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ResourceModelWithAllowedPropertySet.cs new file mode 100644 index 000000000000..e6af9297eede --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ResourceModelWithAllowedPropertySet.cs @@ -0,0 +1,190 @@ +// +// 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.PostgreSQL.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The resource model definition containing the full set of allowed + /// properties for a resource. Except properties bag, there cannot be a top + /// level property outside of this set. + /// + public partial class ResourceModelWithAllowedPropertySet : IResource + { + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySet class. + /// + public ResourceModelWithAllowedPropertySet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySet class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// The geo-location where the resource + /// lives + /// The fully qualified resource ID of the + /// resource that manages this resource. Indicates if this resource is + /// managed by another Azure resource. If this is present, complete + /// mode deployment will not delete the resource if it is removed from + /// the template since it is managed by another resource. + /// Metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type; e.g. + /// ApiApps are a kind of Microsoft.Web/sites type. If supported, the + /// resource provider must validate and persist this value. + /// The etag field is *not* required. If it is + /// provided in the response body, it must also be provided as a header + /// per the normal etag convention. Entity tags are used for comparing + /// two or more entities from the same requested resource. HTTP/1.1 + /// uses entity tags in the etag (section 14.19), If-Match (section + /// 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) + /// header fields. + /// Resource tags. + public ResourceModelWithAllowedPropertySet(string id = default(string), string name = default(string), string type = default(string), string location = default(string), string managedBy = default(string), string kind = default(string), string etag = default(string), IDictionary tags = default(IDictionary), ResourceModelWithAllowedPropertySetIdentity identity = default(ResourceModelWithAllowedPropertySetIdentity), ResourceModelWithAllowedPropertySetSku sku = default(ResourceModelWithAllowedPropertySetSku), ResourceModelWithAllowedPropertySetPlan plan = default(ResourceModelWithAllowedPropertySetPlan)) + { + Id = id; + Name = name; + Type = type; + Location = location; + ManagedBy = managedBy; + Kind = kind; + Etag = etag; + Tags = tags; + Identity = identity; + Sku = sku; + Plan = plan; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets the geo-location where the resource lives + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets the fully qualified resource ID of the resource that + /// manages this resource. Indicates if this resource is managed by + /// another Azure resource. If this is present, complete mode + /// deployment will not delete the resource if it is removed from the + /// template since it is managed by another resource. + /// + [JsonProperty(PropertyName = "managedBy")] + public string ManagedBy { get; set; } + + /// + /// Gets or sets metadata used by portal/tooling/etc to render + /// different UX experiences for resources of the same type; e.g. + /// ApiApps are a kind of Microsoft.Web/sites type. If supported, the + /// resource provider must validate and persist this value. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets the etag field is *not* required. If it is provided in the + /// response body, it must also be provided as a header per the normal + /// etag convention. Entity tags are used for comparing two or more + /// entities from the same requested resource. HTTP/1.1 uses entity + /// tags in the etag (section 14.19), If-Match (section 14.24), + /// If-None-Match (section 14.26), and If-Range (section 14.27) header + /// fields. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// + [JsonProperty(PropertyName = "identity")] + public ResourceModelWithAllowedPropertySetIdentity Identity { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sku")] + public ResourceModelWithAllowedPropertySetSku Sku { get; set; } + + /// + /// + [JsonProperty(PropertyName = "plan")] + public ResourceModelWithAllowedPropertySetPlan Plan { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Kind != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Kind, "^[-\\w\\._,\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "Kind", "^[-\\w\\._,\\(\\)]+$"); + } + } + if (Sku != null) + { + Sku.Validate(); + } + if (Plan != null) + { + Plan.Validate(); + } + } + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ResourceModelWithAllowedPropertySetIdentity.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ResourceModelWithAllowedPropertySetIdentity.cs new file mode 100644 index 000000000000..7b153dea44d5 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ResourceModelWithAllowedPropertySetIdentity.cs @@ -0,0 +1,47 @@ +// +// 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.PostgreSQL.Models +{ + using System.Linq; + + public partial class ResourceModelWithAllowedPropertySetIdentity : Identity + { + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetIdentity class. + /// + public ResourceModelWithAllowedPropertySetIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetIdentity class. + /// + /// The principal ID of resource + /// identity. + /// The tenant ID of resource. + /// The identity type. Possible values include: + /// 'SystemAssigned' + public ResourceModelWithAllowedPropertySetIdentity(string principalId = default(string), string tenantId = default(string), ResourceIdentityType? type = default(ResourceIdentityType?)) + : base(principalId, tenantId, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ResourceModelWithAllowedPropertySetPlan.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ResourceModelWithAllowedPropertySetPlan.cs new file mode 100644 index 000000000000..512fb3c3238e --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ResourceModelWithAllowedPropertySetPlan.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.Models +{ + using System.Linq; + + public partial class ResourceModelWithAllowedPropertySetPlan : Plan + { + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetPlan class. + /// + public ResourceModelWithAllowedPropertySetPlan() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetPlan class. + /// + /// A user defined name of the 3rd Party Artifact + /// that is being procured. + /// The publisher of the 3rd Party Artifact + /// that is being bought. E.g. NewRelic + /// The 3rd Party artifact that is being + /// procured. E.g. NewRelic. Product maps to the OfferID specified for + /// the artifact at the time of Data Market onboarding. + /// A publisher provided promotion code as + /// provisioned in Data Market for the said product/artifact. + /// The version of the desired + /// product/artifact. + public ResourceModelWithAllowedPropertySetPlan(string name, string publisher, string product, string promotionCode = default(string), string version = default(string)) + : base(name, publisher, product, promotionCode, version) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ResourceModelWithAllowedPropertySetSku.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ResourceModelWithAllowedPropertySetSku.cs new file mode 100644 index 000000000000..ecb59fd4097a --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ResourceModelWithAllowedPropertySetSku.cs @@ -0,0 +1,57 @@ +// +// 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.PostgreSQL.Models +{ + using System.Linq; + + public partial class ResourceModelWithAllowedPropertySetSku : Sku + { + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetSku class. + /// + public ResourceModelWithAllowedPropertySetSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceModelWithAllowedPropertySetSku class. + /// + /// The name of the sku, typically, tier + family + + /// cores, e.g. Standard_D4s_v3. + /// The tier of the particular SKU, e.g. Burstable. + /// Possible values include: 'Burstable', 'GeneralPurpose', + /// 'MemoryOptimized' + public ResourceModelWithAllowedPropertySetSku(string name, string tier) + : base(name, tier) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/RestartParameter.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/RestartParameter.cs new file mode 100644 index 000000000000..dff5da3b2cb0 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/RestartParameter.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents server restart parameters. + /// + public partial class RestartParameter + { + /// + /// Initializes a new instance of the RestartParameter class. + /// + public RestartParameter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RestartParameter class. + /// + /// Indicates whether to restart the + /// server with failover. + /// Failover mode. + public RestartParameter(bool? restartWithFailover = default(bool?), string failoverMode = default(string)) + { + RestartWithFailover = restartWithFailover; + FailoverMode = failoverMode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether to restart the server with failover. + /// + [JsonProperty(PropertyName = "restartWithFailover")] + public bool? RestartWithFailover { get; set; } + + /// + /// Gets or sets failover mode. + /// + [JsonProperty(PropertyName = "failoverMode")] + public string FailoverMode { get; set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Server.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Server.cs index 5cb4f611fe04..abd69efd4228 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Server.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Server.cs @@ -36,12 +36,12 @@ public Server() /// /// The geo-location where the resource /// lives - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// Resource tags. /// The Azure Active Directory identity of the /// server. @@ -49,59 +49,60 @@ public Server() /// The administrator's login name of /// a server. Can only be specified when the server is being created /// (and is required for creation). - /// Server version. Possible values include: - /// '9.5', '9.6', '10', '10.0', '10.2', '11' - /// Enable ssl enforcement or not when - /// connect to server. Possible values include: 'Enabled', - /// 'Disabled' - /// Enforce a minimal Tls version for - /// the server. Possible values include: 'TLS1_0', 'TLS1_1', 'TLS1_2', - /// 'TLSEnforcementDisabled' - /// Status showing whether the server - /// data encryption is enabled with customer-managed keys. - /// Status showing whether the - /// server enabled infrastructure encryption. Possible values include: - /// 'Enabled', 'Disabled' - /// A state of a server that is visible - /// to user. Possible values include: 'Ready', 'Dropping', 'Disabled', - /// 'Inaccessible' + /// The administrator login + /// password (required for server creation). + /// PostgreSQL Server version. Possible values + /// include: '13', '12', '11' + /// The minor version of the server. + /// A state of a server that is visible to user. + /// Possible values include: 'Ready', 'Dropping', 'Disabled', + /// 'Starting', 'Stopping', 'Stopped', 'Updating' /// The fully qualified domain /// name of a server. - /// Earliest restore point creation - /// time (ISO8601 format) - /// Storage profile of a server. - /// The replication role of the + /// Storage properties of a server. + /// Backup properties of a server. + /// Network properties of a server. + /// High availability properties of a /// server. - /// The master server id of a replica + /// Maintenance window properties of a /// server. - /// The maximum number of replicas that a - /// master server can have. - /// Whether or not public network - /// access is allowed for this server. Value is optional but if passed - /// in, must be 'Enabled' or 'Disabled'. Possible values include: - /// 'Enabled', 'Disabled' - /// List of private endpoint - /// connections on a server - public Server(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ResourceIdentity identity = default(ResourceIdentity), Sku sku = default(Sku), string administratorLogin = default(string), string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), string minimalTlsVersion = default(string), string byokEnforcement = default(string), string infrastructureEncryption = default(string), string userVisibleState = default(string), string fullyQualifiedDomainName = default(string), System.DateTime? earliestRestoreDate = default(System.DateTime?), StorageProfile storageProfile = default(StorageProfile), string replicationRole = default(string), string masterServerId = default(string), int? replicaCapacity = default(int?), string publicNetworkAccess = default(string), IList privateEndpointConnections = default(IList)) + /// The source server resource ID + /// to restore from. It's required when 'createMode' is + /// 'PointInTimeRestore'. + /// Restore point creation time (ISO8601 + /// format), specifying the time to restore from. It's required when + /// 'createMode' is 'PointInTimeRestore'. + /// availability zone information of the + /// server. + /// The mode to create a new PostgreSQL + /// server. Possible values include: 'Default', 'Create', 'Update', + /// 'PointInTimeRestore' + /// Application-specific metadata in the form + /// of key-value pairs. + /// The system metadata relating to this + /// resource. + public Server(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Identity identity = default(Identity), Sku sku = default(Sku), string administratorLogin = default(string), string administratorLoginPassword = default(string), string version = default(string), string minorVersion = default(string), string state = default(string), string fullyQualifiedDomainName = default(string), Storage storage = default(Storage), Backup backup = default(Backup), Network network = default(Network), HighAvailability highAvailability = default(HighAvailability), MaintenanceWindow maintenanceWindow = default(MaintenanceWindow), string sourceServerResourceId = default(string), System.DateTime? pointInTimeUTC = default(System.DateTime?), string availabilityZone = default(string), string createMode = default(string), IDictionary serverTags = default(IDictionary), SystemData systemData = default(SystemData)) : base(location, id, name, type, tags) { Identity = identity; Sku = sku; AdministratorLogin = administratorLogin; + AdministratorLoginPassword = administratorLoginPassword; Version = version; - SslEnforcement = sslEnforcement; - MinimalTlsVersion = minimalTlsVersion; - ByokEnforcement = byokEnforcement; - InfrastructureEncryption = infrastructureEncryption; - UserVisibleState = userVisibleState; + MinorVersion = minorVersion; + State = state; FullyQualifiedDomainName = fullyQualifiedDomainName; - EarliestRestoreDate = earliestRestoreDate; - StorageProfile = storageProfile; - ReplicationRole = replicationRole; - MasterServerId = masterServerId; - ReplicaCapacity = replicaCapacity; - PublicNetworkAccess = publicNetworkAccess; - PrivateEndpointConnections = privateEndpointConnections; + Storage = storage; + Backup = backup; + Network = network; + HighAvailability = highAvailability; + MaintenanceWindow = maintenanceWindow; + SourceServerResourceId = sourceServerResourceId; + PointInTimeUTC = pointInTimeUTC; + AvailabilityZone = availabilityZone; + CreateMode = createMode; + ServerTags = serverTags; + SystemData = systemData; CustomInit(); } @@ -114,7 +115,7 @@ public Server() /// Gets or sets the Azure Active Directory identity of the server. /// [JsonProperty(PropertyName = "identity")] - public ResourceIdentity Identity { get; set; } + public Identity Identity { get; set; } /// /// Gets or sets the SKU (pricing tier) of the server. @@ -131,99 +132,109 @@ public Server() public string AdministratorLogin { get; set; } /// - /// Gets or sets server version. Possible values include: '9.5', '9.6', - /// '10', '10.0', '10.2', '11' + /// Gets or sets the administrator login password (required for server + /// creation). + /// + [JsonProperty(PropertyName = "properties.administratorLoginPassword")] + public string AdministratorLoginPassword { get; set; } + + /// + /// Gets or sets postgreSQL Server version. Possible values include: + /// '13', '12', '11' /// [JsonProperty(PropertyName = "properties.version")] public string Version { get; set; } /// - /// Gets or sets enable ssl enforcement or not when connect to server. - /// Possible values include: 'Enabled', 'Disabled' + /// Gets the minor version of the server. /// - [JsonProperty(PropertyName = "properties.sslEnforcement")] - public SslEnforcementEnum? SslEnforcement { get; set; } + [JsonProperty(PropertyName = "properties.minorVersion")] + public string MinorVersion { get; private set; } /// - /// Gets or sets enforce a minimal Tls version for the server. Possible - /// values include: 'TLS1_0', 'TLS1_1', 'TLS1_2', - /// 'TLSEnforcementDisabled' + /// Gets a state of a server that is visible to user. Possible values + /// include: 'Ready', 'Dropping', 'Disabled', 'Starting', 'Stopping', + /// 'Stopped', 'Updating' /// - [JsonProperty(PropertyName = "properties.minimalTlsVersion")] - public string MinimalTlsVersion { get; set; } + [JsonProperty(PropertyName = "properties.state")] + public string State { get; private set; } /// - /// Gets status showing whether the server data encryption is enabled - /// with customer-managed keys. + /// Gets the fully qualified domain name of a server. /// - [JsonProperty(PropertyName = "properties.byokEnforcement")] - public string ByokEnforcement { get; private set; } + [JsonProperty(PropertyName = "properties.fullyQualifiedDomainName")] + public string FullyQualifiedDomainName { get; private set; } /// - /// Gets or sets status showing whether the server enabled - /// infrastructure encryption. Possible values include: 'Enabled', - /// 'Disabled' + /// Gets or sets storage properties of a server. /// - [JsonProperty(PropertyName = "properties.infrastructureEncryption")] - public string InfrastructureEncryption { get; set; } + [JsonProperty(PropertyName = "properties.storage")] + public Storage Storage { get; set; } /// - /// Gets or sets a state of a server that is visible to user. Possible - /// values include: 'Ready', 'Dropping', 'Disabled', 'Inaccessible' + /// Gets or sets backup properties of a server. /// - [JsonProperty(PropertyName = "properties.userVisibleState")] - public string UserVisibleState { get; set; } + [JsonProperty(PropertyName = "properties.backup")] + public Backup Backup { get; set; } /// - /// Gets or sets the fully qualified domain name of a server. + /// Gets or sets network properties of a server. /// - [JsonProperty(PropertyName = "properties.fullyQualifiedDomainName")] - public string FullyQualifiedDomainName { get; set; } + [JsonProperty(PropertyName = "properties.network")] + public Network Network { get; set; } /// - /// Gets or sets earliest restore point creation time (ISO8601 format) + /// Gets or sets high availability properties of a server. /// - [JsonProperty(PropertyName = "properties.earliestRestoreDate")] - public System.DateTime? EarliestRestoreDate { get; set; } + [JsonProperty(PropertyName = "properties.highAvailability")] + public HighAvailability HighAvailability { get; set; } /// - /// Gets or sets storage profile of a server. + /// Gets or sets maintenance window properties of a server. /// - [JsonProperty(PropertyName = "properties.storageProfile")] - public StorageProfile StorageProfile { get; set; } + [JsonProperty(PropertyName = "properties.maintenanceWindow")] + public MaintenanceWindow MaintenanceWindow { get; set; } /// - /// Gets or sets the replication role of the server. + /// Gets or sets the source server resource ID to restore from. It's + /// required when 'createMode' is 'PointInTimeRestore'. /// - [JsonProperty(PropertyName = "properties.replicationRole")] - public string ReplicationRole { get; set; } + [JsonProperty(PropertyName = "properties.sourceServerResourceId")] + public string SourceServerResourceId { get; set; } /// - /// Gets or sets the master server id of a replica server. + /// Gets or sets restore point creation time (ISO8601 format), + /// specifying the time to restore from. It's required when + /// 'createMode' is 'PointInTimeRestore'. /// - [JsonProperty(PropertyName = "properties.masterServerId")] - public string MasterServerId { get; set; } + [JsonProperty(PropertyName = "properties.pointInTimeUTC")] + public System.DateTime? PointInTimeUTC { get; set; } /// - /// Gets or sets the maximum number of replicas that a master server - /// can have. + /// Gets or sets availability zone information of the server. /// - [JsonProperty(PropertyName = "properties.replicaCapacity")] - public int? ReplicaCapacity { get; set; } + [JsonProperty(PropertyName = "properties.availabilityZone")] + public string AvailabilityZone { get; set; } /// - /// Gets or sets whether or not public network access is allowed for - /// this server. Value is optional but if passed in, must be 'Enabled' - /// or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + /// Gets or sets the mode to create a new PostgreSQL server. Possible + /// values include: 'Default', 'Create', 'Update', 'PointInTimeRestore' /// - [JsonProperty(PropertyName = "properties.publicNetworkAccess")] - public string PublicNetworkAccess { get; set; } + [JsonProperty(PropertyName = "properties.createMode")] + public string CreateMode { get; set; } /// - /// Gets list of private endpoint connections on a server + /// Gets or sets application-specific metadata in the form of key-value + /// pairs. /// - [JsonProperty(PropertyName = "properties.privateEndpointConnections")] - public IList PrivateEndpointConnections { get; private set; } + [JsonProperty(PropertyName = "properties.tags")] + public IDictionary ServerTags { get; set; } + + /// + /// Gets the system metadata relating to this resource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } /// /// Validate the object. @@ -238,20 +249,6 @@ public override void Validate() { Sku.Validate(); } - if (ReplicaCapacity < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "ReplicaCapacity", 0); - } - if (PrivateEndpointConnections != null) - { - foreach (var element in PrivateEndpointConnections) - { - if (element != null) - { - element.Validate(); - } - } - } } } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerAdministratorResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerAdministratorResource.cs deleted file mode 100644 index c410cd4202db..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerAdministratorResource.cs +++ /dev/null @@ -1,107 +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.PostgreSQL.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a and external administrator to be created. - /// - [Rest.Serialization.JsonTransformation] - public partial class ServerAdministratorResource : ProxyResource - { - /// - /// Initializes a new instance of the ServerAdministratorResource - /// class. - /// - public ServerAdministratorResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServerAdministratorResource - /// class. - /// - /// The server administrator login account - /// name. - /// The server administrator Sid (Secure ID). - /// The server Active Directory Administrator - /// tenant id. - /// Fully qualified resource Id for the resource. Ex - - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. - public ServerAdministratorResource(string login, System.Guid sid, System.Guid tenantId, string id = default(string), string name = default(string), string type = default(string)) - : base(id, name, type) - { - Login = login; - Sid = sid; - TenantId = tenantId; - CustomInit(); - } - /// - /// Static constructor for ServerAdministratorResource class. - /// - static ServerAdministratorResource() - { - AdministratorType = "ActiveDirectory"; - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the server administrator login account name. - /// - [JsonProperty(PropertyName = "properties.login")] - public string Login { get; set; } - - /// - /// Gets or sets the server administrator Sid (Secure ID). - /// - [JsonProperty(PropertyName = "properties.sid")] - public System.Guid Sid { get; set; } - - /// - /// Gets or sets the server Active Directory Administrator tenant id. - /// - [JsonProperty(PropertyName = "properties.tenantId")] - public System.Guid TenantId { get; set; } - - /// - /// The type of administrator. - /// - [JsonProperty(PropertyName = "properties.administratorType")] - public static string AdministratorType { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Login == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Login"); - } - } - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerEditionCapability.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerEditionCapability.cs new file mode 100644 index 000000000000..b8c9ca91c0da --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerEditionCapability.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Server edition capabilities. + /// + public partial class ServerEditionCapability + { + /// + /// Initializes a new instance of the ServerEditionCapability class. + /// + public ServerEditionCapability() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServerEditionCapability class. + /// + /// Server edition name + public ServerEditionCapability(string name = default(string), IList supportedStorageEditions = default(IList), IList supportedServerVersions = default(IList)) + { + Name = name; + SupportedStorageEditions = supportedStorageEditions; + SupportedServerVersions = supportedServerVersions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets server edition name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "supportedStorageEditions")] + public IList SupportedStorageEditions { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "supportedServerVersions")] + public IList SupportedServerVersions { get; private set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerForCreate.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerForCreate.cs deleted file mode 100644 index 78a7a2a70fba..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerForCreate.cs +++ /dev/null @@ -1,111 +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.PostgreSQL.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents a server to be created. - /// - public partial class ServerForCreate - { - /// - /// Initializes a new instance of the ServerForCreate class. - /// - public ServerForCreate() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServerForCreate class. - /// - /// Properties of the server. - /// The location the resource resides - /// in. - /// The Azure Active Directory identity of the - /// server. - /// The SKU (pricing tier) of the server. - /// Application-specific metadata in the form of - /// key-value pairs. - public ServerForCreate(ServerPropertiesForCreate properties, string location, ResourceIdentity identity = default(ResourceIdentity), Sku sku = default(Sku), IDictionary tags = default(IDictionary)) - { - Identity = identity; - Sku = sku; - Properties = properties; - Location = location; - Tags = tags; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the Azure Active Directory identity of the server. - /// - [JsonProperty(PropertyName = "identity")] - public ResourceIdentity Identity { get; set; } - - /// - /// Gets or sets the SKU (pricing tier) of the server. - /// - [JsonProperty(PropertyName = "sku")] - public Sku Sku { get; set; } - - /// - /// Gets or sets properties of the server. - /// - [JsonProperty(PropertyName = "properties")] - public ServerPropertiesForCreate Properties { get; set; } - - /// - /// Gets or sets the location the resource resides in. - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets or sets application-specific metadata in the form of key-value - /// pairs. - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Properties == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); - } - if (Location == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Location"); - } - if (Sku != null) - { - Sku.Validate(); - } - } - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerForUpdate.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerForUpdate.cs new file mode 100644 index 000000000000..7399e499171d --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerForUpdate.cs @@ -0,0 +1,141 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a server to be updated. + /// + [Rest.Serialization.JsonTransformation] + public partial class ServerForUpdate + { + /// + /// Initializes a new instance of the ServerForUpdate class. + /// + public ServerForUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServerForUpdate class. + /// + /// The location the resource resides + /// in. + /// The SKU (pricing tier) of the server. + /// The password of the + /// administrator login. + /// Storage properties of a server. + /// Backup properties of a server. + /// High availability properties of a + /// server. + /// Maintenance window properties of a + /// server. + /// The mode to update a new PostgreSQL + /// server. Possible values include: 'Default', 'Update' + /// Application-specific metadata in the form of + /// key-value pairs. + public ServerForUpdate(string location = default(string), Sku sku = default(Sku), string administratorLoginPassword = default(string), Storage storage = default(Storage), Backup backup = default(Backup), HighAvailability highAvailability = default(HighAvailability), MaintenanceWindow maintenanceWindow = default(MaintenanceWindow), string createMode = default(string), IDictionary tags = default(IDictionary)) + { + Location = location; + Sku = sku; + AdministratorLoginPassword = administratorLoginPassword; + Storage = storage; + Backup = backup; + HighAvailability = highAvailability; + MaintenanceWindow = maintenanceWindow; + CreateMode = createMode; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the location the resource resides in. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets the SKU (pricing tier) of the server. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// Gets or sets the password of the administrator login. + /// + [JsonProperty(PropertyName = "properties.administratorLoginPassword")] + public string AdministratorLoginPassword { get; set; } + + /// + /// Gets or sets storage properties of a server. + /// + [JsonProperty(PropertyName = "properties.storage")] + public Storage Storage { get; set; } + + /// + /// Gets or sets backup properties of a server. + /// + [JsonProperty(PropertyName = "properties.backup")] + public Backup Backup { get; set; } + + /// + /// Gets or sets high availability properties of a server. + /// + [JsonProperty(PropertyName = "properties.highAvailability")] + public HighAvailability HighAvailability { get; set; } + + /// + /// Gets or sets maintenance window properties of a server. + /// + [JsonProperty(PropertyName = "properties.maintenanceWindow")] + public MaintenanceWindow MaintenanceWindow { get; set; } + + /// + /// Gets or sets the mode to update a new PostgreSQL server. Possible + /// values include: 'Default', 'Update' + /// + [JsonProperty(PropertyName = "properties.createMode")] + public string CreateMode { get; set; } + + /// + /// Gets or sets application-specific metadata in the form of key-value + /// pairs. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Sku != null) + { + Sku.Validate(); + } + } + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/InfrastructureEncryption.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerHAState.cs similarity index 51% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/InfrastructureEncryption.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerHAState.cs index 90aed8cf0982..c303cbe08e6a 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/InfrastructureEncryption.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerHAState.cs @@ -12,17 +12,15 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models { /// - /// Defines values for InfrastructureEncryption. + /// Defines values for ServerHAState. /// - public static class InfrastructureEncryption + public static class ServerHAState { - /// - /// Default value for single layer of encryption for data at rest. - /// - public const string Enabled = "Enabled"; - /// - /// Additional (2nd) layer of encryption for data at rest - /// - public const string Disabled = "Disabled"; + public const string NotEnabled = "NotEnabled"; + public const string CreatingStandby = "CreatingStandby"; + public const string ReplicatingData = "ReplicatingData"; + public const string FailingOver = "FailingOver"; + public const string Healthy = "Healthy"; + public const string RemovingStandby = "RemovingStandby"; } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerKey.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerKey.cs deleted file mode 100644 index 113635eb5fd6..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerKey.cs +++ /dev/null @@ -1,91 +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.PostgreSQL.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// A PostgreSQL Server key. - /// - [Rest.Serialization.JsonTransformation] - public partial class ServerKey : ProxyResource - { - /// - /// Initializes a new instance of the ServerKey class. - /// - public ServerKey() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServerKey class. - /// - /// Fully qualified resource Id for the resource. Ex - - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. - /// Kind of encryption protector used to protect the - /// key. - /// The URI of the key. - /// The key creation date. - public ServerKey(string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string uri = default(string), System.DateTime? creationDate = default(System.DateTime?)) - : base(id, name, type) - { - Kind = kind; - Uri = uri; - CreationDate = creationDate; - CustomInit(); - } - /// - /// Static constructor for ServerKey class. - /// - static ServerKey() - { - ServerKeyType = "AzureKeyVault"; - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets kind of encryption protector used to protect the key. - /// - [JsonProperty(PropertyName = "kind")] - public string Kind { get; private set; } - - /// - /// Gets or sets the URI of the key. - /// - [JsonProperty(PropertyName = "properties.uri")] - public string Uri { get; set; } - - /// - /// Gets the key creation date. - /// - [JsonProperty(PropertyName = "properties.creationDate")] - public System.DateTime? CreationDate { get; private set; } - - /// - /// The key type like 'AzureKeyVault'. - /// - [JsonProperty(PropertyName = "properties.serverKeyType")] - public static string ServerKeyType { get; private set; } - - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPrivateEndpointConnection.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPrivateEndpointConnection.cs deleted file mode 100644 index b711754ebf94..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPrivateEndpointConnection.cs +++ /dev/null @@ -1,76 +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.PostgreSQL.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A private endpoint connection under a server - /// - public partial class ServerPrivateEndpointConnection - { - /// - /// Initializes a new instance of the ServerPrivateEndpointConnection - /// class. - /// - public ServerPrivateEndpointConnection() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServerPrivateEndpointConnection - /// class. - /// - /// Resource ID of the Private Endpoint - /// Connection. - /// Private endpoint connection - /// properties - public ServerPrivateEndpointConnection(string id = default(string), ServerPrivateEndpointConnectionProperties properties = default(ServerPrivateEndpointConnectionProperties)) - { - Id = id; - Properties = properties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets resource ID of the Private Endpoint Connection. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets private endpoint connection properties - /// - [JsonProperty(PropertyName = "properties")] - public ServerPrivateEndpointConnectionProperties Properties { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Properties != null) - { - Properties.Validate(); - } - } - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPrivateEndpointConnectionProperties.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPrivateEndpointConnectionProperties.cs deleted file mode 100644 index 915658ad2375..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPrivateEndpointConnectionProperties.cs +++ /dev/null @@ -1,87 +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.PostgreSQL.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Properties of a private endpoint connection. - /// - public partial class ServerPrivateEndpointConnectionProperties - { - /// - /// Initializes a new instance of the - /// ServerPrivateEndpointConnectionProperties class. - /// - public ServerPrivateEndpointConnectionProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// ServerPrivateEndpointConnectionProperties class. - /// - /// Private endpoint which the connection - /// belongs to. - /// Connection state of - /// the private endpoint connection. - /// State of the private endpoint - /// connection. Possible values include: 'Approving', 'Ready', - /// 'Dropping', 'Failed', 'Rejecting' - public ServerPrivateEndpointConnectionProperties(PrivateEndpointProperty privateEndpoint = default(PrivateEndpointProperty), ServerPrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState = default(ServerPrivateLinkServiceConnectionStateProperty), string provisioningState = default(string)) - { - PrivateEndpoint = privateEndpoint; - PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; - ProvisioningState = provisioningState; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets private endpoint which the connection belongs to. - /// - [JsonProperty(PropertyName = "privateEndpoint")] - public PrivateEndpointProperty PrivateEndpoint { get; set; } - - /// - /// Gets or sets connection state of the private endpoint connection. - /// - [JsonProperty(PropertyName = "privateLinkServiceConnectionState")] - public ServerPrivateLinkServiceConnectionStateProperty PrivateLinkServiceConnectionState { get; set; } - - /// - /// Gets state of the private endpoint connection. Possible values - /// include: 'Approving', 'Ready', 'Dropping', 'Failed', 'Rejecting' - /// - [JsonProperty(PropertyName = "provisioningState")] - public string ProvisioningState { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (PrivateLinkServiceConnectionState != null) - { - PrivateLinkServiceConnectionState.Validate(); - } - } - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPrivateLinkServiceConnectionStateProperty.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPrivateLinkServiceConnectionStateProperty.cs deleted file mode 100644 index fe0849058efd..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPrivateLinkServiceConnectionStateProperty.cs +++ /dev/null @@ -1,90 +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.PostgreSQL.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - public partial class ServerPrivateLinkServiceConnectionStateProperty - { - /// - /// Initializes a new instance of the - /// ServerPrivateLinkServiceConnectionStateProperty class. - /// - public ServerPrivateLinkServiceConnectionStateProperty() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// ServerPrivateLinkServiceConnectionStateProperty class. - /// - /// The private link service connection status. - /// Possible values include: 'Approved', 'Pending', 'Rejected', - /// 'Disconnected' - /// The private link service connection - /// description. - /// The actions required for private link - /// service connection. Possible values include: 'None' - public ServerPrivateLinkServiceConnectionStateProperty(string status, string description, string actionsRequired = default(string)) - { - Status = status; - Description = description; - ActionsRequired = actionsRequired; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the private link service connection status. Possible - /// values include: 'Approved', 'Pending', 'Rejected', 'Disconnected' - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } - - /// - /// Gets or sets the private link service connection description. - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - - /// - /// Gets the actions required for private link service connection. - /// Possible values include: 'None' - /// - [JsonProperty(PropertyName = "actionsRequired")] - public string ActionsRequired { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Status == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Status"); - } - if (Description == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Description"); - } - } - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForCreate.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForCreate.cs deleted file mode 100644 index 2f0292d2b463..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForCreate.cs +++ /dev/null @@ -1,109 +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.PostgreSQL.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The properties used to create a new server. - /// - public partial class ServerPropertiesForCreate - { - /// - /// Initializes a new instance of the ServerPropertiesForCreate class. - /// - public ServerPropertiesForCreate() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServerPropertiesForCreate class. - /// - /// Server version. Possible values include: - /// '9.5', '9.6', '10', '10.0', '10.2', '11' - /// Enable ssl enforcement or not when - /// connect to server. Possible values include: 'Enabled', - /// 'Disabled' - /// Enforce a minimal Tls version for - /// the server. Possible values include: 'TLS1_0', 'TLS1_1', 'TLS1_2', - /// 'TLSEnforcementDisabled' - /// Status showing whether the - /// server enabled infrastructure encryption. Possible values include: - /// 'Enabled', 'Disabled' - /// Whether or not public network - /// access is allowed for this server. Value is optional but if passed - /// in, must be 'Enabled' or 'Disabled'. Possible values include: - /// 'Enabled', 'Disabled' - /// Storage profile of a server. - public ServerPropertiesForCreate(string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), string minimalTlsVersion = default(string), string infrastructureEncryption = default(string), string publicNetworkAccess = default(string), StorageProfile storageProfile = default(StorageProfile)) - { - Version = version; - SslEnforcement = sslEnforcement; - MinimalTlsVersion = minimalTlsVersion; - InfrastructureEncryption = infrastructureEncryption; - PublicNetworkAccess = publicNetworkAccess; - StorageProfile = storageProfile; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets server version. Possible values include: '9.5', '9.6', - /// '10', '10.0', '10.2', '11' - /// - [JsonProperty(PropertyName = "version")] - public string Version { get; set; } - - /// - /// Gets or sets enable ssl enforcement or not when connect to server. - /// Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "sslEnforcement")] - public SslEnforcementEnum? SslEnforcement { get; set; } - - /// - /// Gets or sets enforce a minimal Tls version for the server. Possible - /// values include: 'TLS1_0', 'TLS1_1', 'TLS1_2', - /// 'TLSEnforcementDisabled' - /// - [JsonProperty(PropertyName = "minimalTlsVersion")] - public string MinimalTlsVersion { get; set; } - - /// - /// Gets or sets status showing whether the server enabled - /// infrastructure encryption. Possible values include: 'Enabled', - /// 'Disabled' - /// - [JsonProperty(PropertyName = "infrastructureEncryption")] - public string InfrastructureEncryption { get; set; } - - /// - /// Gets or sets whether or not public network access is allowed for - /// this server. Value is optional but if passed in, must be 'Enabled' - /// or 'Disabled'. Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "publicNetworkAccess")] - public string PublicNetworkAccess { get; set; } - - /// - /// Gets or sets storage profile of a server. - /// - [JsonProperty(PropertyName = "storageProfile")] - public StorageProfile StorageProfile { get; set; } - - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForDefaultCreate.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForDefaultCreate.cs deleted file mode 100644 index 788f62930bd3..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForDefaultCreate.cs +++ /dev/null @@ -1,102 +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.PostgreSQL.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// The properties used to create a new server. - /// - [Newtonsoft.Json.JsonObject("Default")] - public partial class ServerPropertiesForDefaultCreate : ServerPropertiesForCreate - { - /// - /// Initializes a new instance of the ServerPropertiesForDefaultCreate - /// class. - /// - public ServerPropertiesForDefaultCreate() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServerPropertiesForDefaultCreate - /// class. - /// - /// The administrator's login name of - /// a server. Can only be specified when the server is being created - /// (and is required for creation). - /// The password of the - /// administrator login. - /// Server version. Possible values include: - /// '9.5', '9.6', '10', '10.0', '10.2', '11' - /// Enable ssl enforcement or not when - /// connect to server. Possible values include: 'Enabled', - /// 'Disabled' - /// Enforce a minimal Tls version for - /// the server. Possible values include: 'TLS1_0', 'TLS1_1', 'TLS1_2', - /// 'TLSEnforcementDisabled' - /// Status showing whether the - /// server enabled infrastructure encryption. Possible values include: - /// 'Enabled', 'Disabled' - /// Whether or not public network - /// access is allowed for this server. Value is optional but if passed - /// in, must be 'Enabled' or 'Disabled'. Possible values include: - /// 'Enabled', 'Disabled' - /// Storage profile of a server. - public ServerPropertiesForDefaultCreate(string administratorLogin, string administratorLoginPassword, string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), string minimalTlsVersion = default(string), string infrastructureEncryption = default(string), string publicNetworkAccess = default(string), StorageProfile storageProfile = default(StorageProfile)) - : base(version, sslEnforcement, minimalTlsVersion, infrastructureEncryption, publicNetworkAccess, storageProfile) - { - AdministratorLogin = administratorLogin; - AdministratorLoginPassword = administratorLoginPassword; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the administrator's login name of a server. Can only - /// be specified when the server is being created (and is required for - /// creation). - /// - [JsonProperty(PropertyName = "administratorLogin")] - public string AdministratorLogin { get; set; } - - /// - /// Gets or sets the password of the administrator login. - /// - [JsonProperty(PropertyName = "administratorLoginPassword")] - public string AdministratorLoginPassword { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (AdministratorLogin == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AdministratorLogin"); - } - if (AdministratorLoginPassword == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AdministratorLoginPassword"); - } - } - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForGeoRestore.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForGeoRestore.cs deleted file mode 100644 index 8e52f7d9b123..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForGeoRestore.cs +++ /dev/null @@ -1,87 +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.PostgreSQL.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// The properties used to create a new server by restoring to a different - /// region from a geo replicated backup. - /// - [Newtonsoft.Json.JsonObject("GeoRestore")] - public partial class ServerPropertiesForGeoRestore : ServerPropertiesForCreate - { - /// - /// Initializes a new instance of the ServerPropertiesForGeoRestore - /// class. - /// - public ServerPropertiesForGeoRestore() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServerPropertiesForGeoRestore - /// class. - /// - /// The source server id to restore - /// from. - /// Server version. Possible values include: - /// '9.5', '9.6', '10', '10.0', '10.2', '11' - /// Enable ssl enforcement or not when - /// connect to server. Possible values include: 'Enabled', - /// 'Disabled' - /// Enforce a minimal Tls version for - /// the server. Possible values include: 'TLS1_0', 'TLS1_1', 'TLS1_2', - /// 'TLSEnforcementDisabled' - /// Status showing whether the - /// server enabled infrastructure encryption. Possible values include: - /// 'Enabled', 'Disabled' - /// Whether or not public network - /// access is allowed for this server. Value is optional but if passed - /// in, must be 'Enabled' or 'Disabled'. Possible values include: - /// 'Enabled', 'Disabled' - /// Storage profile of a server. - public ServerPropertiesForGeoRestore(string sourceServerId, string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), string minimalTlsVersion = default(string), string infrastructureEncryption = default(string), string publicNetworkAccess = default(string), StorageProfile storageProfile = default(StorageProfile)) - : base(version, sslEnforcement, minimalTlsVersion, infrastructureEncryption, publicNetworkAccess, storageProfile) - { - SourceServerId = sourceServerId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the source server id to restore from. - /// - [JsonProperty(PropertyName = "sourceServerId")] - public string SourceServerId { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (SourceServerId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "SourceServerId"); - } - } - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForReplica.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForReplica.cs deleted file mode 100644 index 263423778b47..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForReplica.cs +++ /dev/null @@ -1,84 +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.PostgreSQL.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// The properties to create a new replica. - /// - [Newtonsoft.Json.JsonObject("Replica")] - public partial class ServerPropertiesForReplica : ServerPropertiesForCreate - { - /// - /// Initializes a new instance of the ServerPropertiesForReplica class. - /// - public ServerPropertiesForReplica() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServerPropertiesForReplica class. - /// - /// The master server id to create replica - /// from. - /// Server version. Possible values include: - /// '9.5', '9.6', '10', '10.0', '10.2', '11' - /// Enable ssl enforcement or not when - /// connect to server. Possible values include: 'Enabled', - /// 'Disabled' - /// Enforce a minimal Tls version for - /// the server. Possible values include: 'TLS1_0', 'TLS1_1', 'TLS1_2', - /// 'TLSEnforcementDisabled' - /// Status showing whether the - /// server enabled infrastructure encryption. Possible values include: - /// 'Enabled', 'Disabled' - /// Whether or not public network - /// access is allowed for this server. Value is optional but if passed - /// in, must be 'Enabled' or 'Disabled'. Possible values include: - /// 'Enabled', 'Disabled' - /// Storage profile of a server. - public ServerPropertiesForReplica(string sourceServerId, string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), string minimalTlsVersion = default(string), string infrastructureEncryption = default(string), string publicNetworkAccess = default(string), StorageProfile storageProfile = default(StorageProfile)) - : base(version, sslEnforcement, minimalTlsVersion, infrastructureEncryption, publicNetworkAccess, storageProfile) - { - SourceServerId = sourceServerId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the master server id to create replica from. - /// - [JsonProperty(PropertyName = "sourceServerId")] - public string SourceServerId { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (SourceServerId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "SourceServerId"); - } - } - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForRestore.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForRestore.cs deleted file mode 100644 index 267d2054da1c..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForRestore.cs +++ /dev/null @@ -1,94 +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.PostgreSQL.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// The properties used to create a new server by restoring from a backup. - /// - [Newtonsoft.Json.JsonObject("PointInTimeRestore")] - public partial class ServerPropertiesForRestore : ServerPropertiesForCreate - { - /// - /// Initializes a new instance of the ServerPropertiesForRestore class. - /// - public ServerPropertiesForRestore() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServerPropertiesForRestore class. - /// - /// The source server id to restore - /// from. - /// Restore point creation time - /// (ISO8601 format), specifying the time to restore from. - /// Server version. Possible values include: - /// '9.5', '9.6', '10', '10.0', '10.2', '11' - /// Enable ssl enforcement or not when - /// connect to server. Possible values include: 'Enabled', - /// 'Disabled' - /// Enforce a minimal Tls version for - /// the server. Possible values include: 'TLS1_0', 'TLS1_1', 'TLS1_2', - /// 'TLSEnforcementDisabled' - /// Status showing whether the - /// server enabled infrastructure encryption. Possible values include: - /// 'Enabled', 'Disabled' - /// Whether or not public network - /// access is allowed for this server. Value is optional but if passed - /// in, must be 'Enabled' or 'Disabled'. Possible values include: - /// 'Enabled', 'Disabled' - /// Storage profile of a server. - public ServerPropertiesForRestore(string sourceServerId, System.DateTime restorePointInTime, string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), string minimalTlsVersion = default(string), string infrastructureEncryption = default(string), string publicNetworkAccess = default(string), StorageProfile storageProfile = default(StorageProfile)) - : base(version, sslEnforcement, minimalTlsVersion, infrastructureEncryption, publicNetworkAccess, storageProfile) - { - SourceServerId = sourceServerId; - RestorePointInTime = restorePointInTime; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the source server id to restore from. - /// - [JsonProperty(PropertyName = "sourceServerId")] - public string SourceServerId { get; set; } - - /// - /// Gets or sets restore point creation time (ISO8601 format), - /// specifying the time to restore from. - /// - [JsonProperty(PropertyName = "restorePointInTime")] - public System.DateTime RestorePointInTime { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (SourceServerId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "SourceServerId"); - } - } - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/StorageAutogrow.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPublicNetworkAccessState.cs similarity index 83% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/StorageAutogrow.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPublicNetworkAccessState.cs index 4fb501782f93..8f280a597b1d 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/StorageAutogrow.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPublicNetworkAccessState.cs @@ -12,9 +12,9 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models { /// - /// Defines values for StorageAutogrow. + /// Defines values for ServerPublicNetworkAccessState. /// - public static class StorageAutogrow + public static class ServerPublicNetworkAccessState { public const string Enabled = "Enabled"; public const string Disabled = "Disabled"; diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerSecurityAlertPolicy.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerSecurityAlertPolicy.cs deleted file mode 100644 index 06b616df3135..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerSecurityAlertPolicy.cs +++ /dev/null @@ -1,139 +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.PostgreSQL.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A server security alert policy. - /// - [Rest.Serialization.JsonTransformation] - public partial class ServerSecurityAlertPolicy : ProxyResource - { - /// - /// Initializes a new instance of the ServerSecurityAlertPolicy class. - /// - public ServerSecurityAlertPolicy() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServerSecurityAlertPolicy class. - /// - /// Specifies the state of the policy, whether it - /// is enabled or disabled. Possible values include: 'Enabled', - /// 'Disabled' - /// Fully qualified resource Id for the resource. Ex - - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. - /// Specifies an array of alerts that are - /// disabled. Allowed values are: Sql_Injection, - /// Sql_Injection_Vulnerability, Access_Anomaly - /// Specifies an array of e-mail addresses - /// to which the alert is sent. - /// Specifies that the alert is sent - /// to the account administrators. - /// Specifies the blob storage endpoint - /// (e.g. https://MyAccount.blob.core.windows.net). This blob storage - /// will hold all Threat Detection audit logs. - /// Specifies the identifier key - /// of the Threat Detection audit storage account. - /// Specifies the number of days to keep in - /// the Threat Detection audit logs. - public ServerSecurityAlertPolicy(ServerSecurityAlertPolicyState state, string id = default(string), string name = default(string), string type = default(string), IList disabledAlerts = default(IList), IList emailAddresses = default(IList), bool? emailAccountAdmins = default(bool?), string storageEndpoint = default(string), string storageAccountAccessKey = default(string), int? retentionDays = default(int?)) - : base(id, name, type) - { - State = state; - DisabledAlerts = disabledAlerts; - EmailAddresses = emailAddresses; - EmailAccountAdmins = emailAccountAdmins; - StorageEndpoint = storageEndpoint; - StorageAccountAccessKey = storageAccountAccessKey; - RetentionDays = retentionDays; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets specifies the state of the policy, whether it is - /// enabled or disabled. Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "properties.state")] - public ServerSecurityAlertPolicyState State { get; set; } - - /// - /// Gets or sets specifies an array of alerts that are disabled. - /// Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, - /// Access_Anomaly - /// - [JsonProperty(PropertyName = "properties.disabledAlerts")] - public IList DisabledAlerts { get; set; } - - /// - /// Gets or sets specifies an array of e-mail addresses to which the - /// alert is sent. - /// - [JsonProperty(PropertyName = "properties.emailAddresses")] - public IList EmailAddresses { get; set; } - - /// - /// Gets or sets specifies that the alert is sent to the account - /// administrators. - /// - [JsonProperty(PropertyName = "properties.emailAccountAdmins")] - public bool? EmailAccountAdmins { get; set; } - - /// - /// Gets or sets specifies the blob storage endpoint (e.g. - /// https://MyAccount.blob.core.windows.net). This blob storage will - /// hold all Threat Detection audit logs. - /// - [JsonProperty(PropertyName = "properties.storageEndpoint")] - public string StorageEndpoint { get; set; } - - /// - /// Gets or sets specifies the identifier key of the Threat Detection - /// audit storage account. - /// - [JsonProperty(PropertyName = "properties.storageAccountAccessKey")] - public string StorageAccountAccessKey { get; set; } - - /// - /// Gets or sets specifies the number of days to keep in the Threat - /// Detection audit logs. - /// - [JsonProperty(PropertyName = "properties.retentionDays")] - public int? RetentionDays { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - } - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerSecurityAlertPolicyState.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerSecurityAlertPolicyState.cs deleted file mode 100644 index d26b911546a0..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerSecurityAlertPolicyState.cs +++ /dev/null @@ -1,60 +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.PostgreSQL.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for ServerSecurityAlertPolicyState. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum ServerSecurityAlertPolicyState - { - [EnumMember(Value = "Enabled")] - Enabled, - [EnumMember(Value = "Disabled")] - Disabled - } - internal static class ServerSecurityAlertPolicyStateEnumExtension - { - internal static string ToSerializedValue(this ServerSecurityAlertPolicyState? value) - { - return value == null ? null : ((ServerSecurityAlertPolicyState)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this ServerSecurityAlertPolicyState value) - { - switch( value ) - { - case ServerSecurityAlertPolicyState.Enabled: - return "Enabled"; - case ServerSecurityAlertPolicyState.Disabled: - return "Disabled"; - } - return null; - } - - internal static ServerSecurityAlertPolicyState? ParseServerSecurityAlertPolicyState(this string value) - { - switch( value ) - { - case "Enabled": - return ServerSecurityAlertPolicyState.Enabled; - case "Disabled": - return ServerSecurityAlertPolicyState.Disabled; - } - return null; - } - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerState.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerState.cs index 024c8530e8bf..d4928215ec91 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerState.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerState.cs @@ -19,6 +19,9 @@ public static class ServerState public const string Ready = "Ready"; public const string Dropping = "Dropping"; public const string Disabled = "Disabled"; - public const string Inaccessible = "Inaccessible"; + public const string Starting = "Starting"; + public const string Stopping = "Stopping"; + public const string Stopped = "Stopped"; + public const string Updating = "Updating"; } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerUpdateParameters.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerUpdateParameters.cs deleted file mode 100644 index 52022e31dfcb..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerUpdateParameters.cs +++ /dev/null @@ -1,160 +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.PostgreSQL.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Parameters allowed to update for a server. - /// - [Rest.Serialization.JsonTransformation] - public partial class ServerUpdateParameters - { - /// - /// Initializes a new instance of the ServerUpdateParameters class. - /// - public ServerUpdateParameters() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServerUpdateParameters class. - /// - /// The Azure Active Directory identity of the - /// server. - /// The SKU (pricing tier) of the server. - /// Storage profile of a server. - /// The password of the - /// administrator login. - /// The version of a server. Possible values - /// include: '9.5', '9.6', '10', '10.0', '10.2', '11' - /// Enable ssl enforcement or not when - /// connect to server. Possible values include: 'Enabled', - /// 'Disabled' - /// Enforce a minimal Tls version for - /// the server. Possible values include: 'TLS1_0', 'TLS1_1', 'TLS1_2', - /// 'TLSEnforcementDisabled' - /// Whether or not public network - /// access is allowed for this server. Value is optional but if passed - /// in, must be 'Enabled' or 'Disabled'. Possible values include: - /// 'Enabled', 'Disabled' - /// The replication role of the - /// server. - /// Application-specific metadata in the form of - /// key-value pairs. - public ServerUpdateParameters(ResourceIdentity identity = default(ResourceIdentity), Sku sku = default(Sku), StorageProfile storageProfile = default(StorageProfile), string administratorLoginPassword = default(string), string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), string minimalTlsVersion = default(string), string publicNetworkAccess = default(string), string replicationRole = default(string), IDictionary tags = default(IDictionary)) - { - Identity = identity; - Sku = sku; - StorageProfile = storageProfile; - AdministratorLoginPassword = administratorLoginPassword; - Version = version; - SslEnforcement = sslEnforcement; - MinimalTlsVersion = minimalTlsVersion; - PublicNetworkAccess = publicNetworkAccess; - ReplicationRole = replicationRole; - Tags = tags; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the Azure Active Directory identity of the server. - /// - [JsonProperty(PropertyName = "identity")] - public ResourceIdentity Identity { get; set; } - - /// - /// Gets or sets the SKU (pricing tier) of the server. - /// - [JsonProperty(PropertyName = "sku")] - public Sku Sku { get; set; } - - /// - /// Gets or sets storage profile of a server. - /// - [JsonProperty(PropertyName = "properties.storageProfile")] - public StorageProfile StorageProfile { get; set; } - - /// - /// Gets or sets the password of the administrator login. - /// - [JsonProperty(PropertyName = "properties.administratorLoginPassword")] - public string AdministratorLoginPassword { get; set; } - - /// - /// Gets or sets the version of a server. Possible values include: - /// '9.5', '9.6', '10', '10.0', '10.2', '11' - /// - [JsonProperty(PropertyName = "properties.version")] - public string Version { get; set; } - - /// - /// Gets or sets enable ssl enforcement or not when connect to server. - /// Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "properties.sslEnforcement")] - public SslEnforcementEnum? SslEnforcement { get; set; } - - /// - /// Gets or sets enforce a minimal Tls version for the server. Possible - /// values include: 'TLS1_0', 'TLS1_1', 'TLS1_2', - /// 'TLSEnforcementDisabled' - /// - [JsonProperty(PropertyName = "properties.minimalTlsVersion")] - public string MinimalTlsVersion { get; set; } - - /// - /// Gets or sets whether or not public network access is allowed for - /// this server. Value is optional but if passed in, must be 'Enabled' - /// or 'Disabled'. Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "properties.publicNetworkAccess")] - public string PublicNetworkAccess { get; set; } - - /// - /// Gets or sets the replication role of the server. - /// - [JsonProperty(PropertyName = "properties.replicationRole")] - public string ReplicationRole { get; set; } - - /// - /// Gets or sets application-specific metadata in the form of key-value - /// pairs. - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Sku != null) - { - Sku.Validate(); - } - } - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerVersion.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerVersion.cs index 195c933c4628..4540fd51718a 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerVersion.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerVersion.cs @@ -16,11 +16,8 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models /// public static class ServerVersion { - public const string NineFullStopFive = "9.5"; - public const string NineFullStopSix = "9.6"; - public const string OneZero = "10"; - public const string OneZeroFullStopZero = "10.0"; - public const string OneZeroFullStopTwo = "10.2"; + public const string OneThree = "13"; + public const string OneTwo = "12"; public const string OneOne = "11"; } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerVersionCapability.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerVersionCapability.cs new file mode 100644 index 000000000000..292921617c1e --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerVersionCapability.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.PostgreSQL.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Server version capabilities. + /// + public partial class ServerVersionCapability + { + /// + /// Initializes a new instance of the ServerVersionCapability class. + /// + public ServerVersionCapability() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServerVersionCapability class. + /// + /// server version + public ServerVersionCapability(string name = default(string), IList supportedVcores = default(IList)) + { + Name = name; + SupportedVcores = supportedVcores; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets server version + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "supportedVcores")] + public IList SupportedVcores { get; private set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Sku.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Sku.cs index a38e9ed36c75..679775494033 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Sku.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Sku.cs @@ -15,7 +15,7 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models using System.Linq; /// - /// Billing information related properties of a server. + /// Sku information related properties of a server. /// public partial class Sku { @@ -31,22 +31,14 @@ public Sku() /// Initializes a new instance of the Sku class. /// /// The name of the sku, typically, tier + family + - /// cores, e.g. B_Gen4_1, GP_Gen5_8. - /// The tier of the particular SKU, e.g. Basic. - /// Possible values include: 'Basic', 'GeneralPurpose', + /// cores, e.g. Standard_D4s_v3. + /// The tier of the particular SKU, e.g. Burstable. + /// Possible values include: 'Burstable', 'GeneralPurpose', /// 'MemoryOptimized' - /// The scale up/out capacity, representing - /// server's compute units. - /// The size code, to be interpreted by resource as - /// appropriate. - /// The family of hardware. - public Sku(string name, string tier = default(string), int? capacity = default(int?), string size = default(string), string family = default(string)) + public Sku(string name, string tier) { Name = name; Tier = tier; - Capacity = capacity; - Size = size; - Family = family; CustomInit(); } @@ -57,38 +49,19 @@ public Sku() /// /// Gets or sets the name of the sku, typically, tier + family + cores, - /// e.g. B_Gen4_1, GP_Gen5_8. + /// e.g. Standard_D4s_v3. /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// - /// Gets or sets the tier of the particular SKU, e.g. Basic. Possible - /// values include: 'Basic', 'GeneralPurpose', 'MemoryOptimized' + /// Gets or sets the tier of the particular SKU, e.g. Burstable. + /// Possible values include: 'Burstable', 'GeneralPurpose', + /// 'MemoryOptimized' /// [JsonProperty(PropertyName = "tier")] public string Tier { get; set; } - /// - /// Gets or sets the scale up/out capacity, representing server's - /// compute units. - /// - [JsonProperty(PropertyName = "capacity")] - public int? Capacity { get; set; } - - /// - /// Gets or sets the size code, to be interpreted by resource as - /// appropriate. - /// - [JsonProperty(PropertyName = "size")] - public string Size { get; set; } - - /// - /// Gets or sets the family of hardware. - /// - [JsonProperty(PropertyName = "family")] - public string Family { get; set; } - /// /// Validate the object. /// @@ -101,9 +74,9 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Name"); } - if (Capacity < 0) + if (Tier == null) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Capacity", 0); + throw new ValidationException(ValidationRules.CannotBeNull, "Tier"); } } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/SkuTier.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/SkuTier.cs index 86ab674570a2..312761e49678 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/SkuTier.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/SkuTier.cs @@ -16,7 +16,7 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models /// public static class SkuTier { - public const string Basic = "Basic"; + public const string Burstable = "Burstable"; public const string GeneralPurpose = "GeneralPurpose"; public const string MemoryOptimized = "MemoryOptimized"; } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/SslEnforcementEnum.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/SslEnforcementEnum.cs deleted file mode 100644 index c11a31e8fd06..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/SslEnforcementEnum.cs +++ /dev/null @@ -1,60 +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.PostgreSQL.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for SslEnforcementEnum. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum SslEnforcementEnum - { - [EnumMember(Value = "Enabled")] - Enabled, - [EnumMember(Value = "Disabled")] - Disabled - } - internal static class SslEnforcementEnumEnumExtension - { - internal static string ToSerializedValue(this SslEnforcementEnum? value) - { - return value == null ? null : ((SslEnforcementEnum)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this SslEnforcementEnum value) - { - switch( value ) - { - case SslEnforcementEnum.Enabled: - return "Enabled"; - case SslEnforcementEnum.Disabled: - return "Disabled"; - } - return null; - } - - internal static SslEnforcementEnum? ParseSslEnforcementEnum(this string value) - { - switch( value ) - { - case "Enabled": - return SslEnforcementEnum.Enabled; - case "Disabled": - return SslEnforcementEnum.Disabled; - } - return null; - } - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/TagsObject.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Storage.cs similarity index 59% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/TagsObject.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Storage.cs index b1b7e3cfab0a..f6d62199ab9e 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/TagsObject.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Storage.cs @@ -11,30 +11,29 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models { using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// - /// Tags object for patch operations. + /// Storage properties of a server /// - public partial class TagsObject + public partial class Storage { /// - /// Initializes a new instance of the TagsObject class. + /// Initializes a new instance of the Storage class. /// - public TagsObject() + public Storage() { CustomInit(); } /// - /// Initializes a new instance of the TagsObject class. + /// Initializes a new instance of the Storage class. /// - /// Resource tags. - public TagsObject(IDictionary tags = default(IDictionary)) + /// Max storage allowed for a + /// server. + public Storage(int? storageSizeGB = default(int?)) { - Tags = tags; + StorageSizeGB = storageSizeGB; CustomInit(); } @@ -44,10 +43,10 @@ public TagsObject() partial void CustomInit(); /// - /// Gets or sets resource tags. + /// Gets or sets max storage allowed for a server. /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } + [JsonProperty(PropertyName = "storageSizeGB")] + public int? StorageSizeGB { get; set; } } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/StorageEditionCapability.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/StorageEditionCapability.cs new file mode 100644 index 000000000000..5446e5e68568 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/StorageEditionCapability.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.PostgreSQL.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// storage edition capability + /// + public partial class StorageEditionCapability + { + /// + /// Initializes a new instance of the StorageEditionCapability class. + /// + public StorageEditionCapability() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StorageEditionCapability class. + /// + /// storage edition name + public StorageEditionCapability(string name = default(string), IList supportedStorageMB = default(IList)) + { + Name = name; + SupportedStorageMB = supportedStorageMB; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets storage edition name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "supportedStorageMB")] + public IList SupportedStorageMB { get; private set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/StorageMBCapability.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/StorageMBCapability.cs new file mode 100644 index 000000000000..a7c95764a185 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/StorageMBCapability.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// storage size in MB capability + /// + public partial class StorageMBCapability + { + /// + /// Initializes a new instance of the StorageMBCapability class. + /// + public StorageMBCapability() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StorageMBCapability class. + /// + /// storage MB name + /// supported IOPS + /// storage size in MB + public StorageMBCapability(string name = default(string), long? supportedIops = default(long?), long? storageSizeMB = default(long?)) + { + Name = name; + SupportedIops = supportedIops; + StorageSizeMB = storageSizeMB; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets storage MB name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets supported IOPS + /// + [JsonProperty(PropertyName = "supportedIops")] + public long? SupportedIops { get; private set; } + + /// + /// Gets storage size in MB + /// + [JsonProperty(PropertyName = "storageSizeMB")] + public long? StorageSizeMB { get; private set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/SystemData.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/SystemData.cs new file mode 100644 index 000000000000..9149d6cbb796 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/SystemData.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metadata pertaining to creation and last modification of the resource. + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// The identity that created the + /// resource. + /// The type of identity that created the + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// The timestamp of resource creation + /// (UTC). + /// The identity that last modified the + /// resource. + /// The type of identity that last + /// modified the resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The timestamp of resource last + /// modification (UTC) + public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity that created the resource. + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets the type of identity that created the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "createdByType")] + public string CreatedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource creation (UTC). + /// + [JsonProperty(PropertyName = "createdAt")] + public System.DateTime? CreatedAt { get; set; } + + /// + /// Gets or sets the identity that last modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public string LastModifiedBy { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "lastModifiedByType")] + public string LastModifiedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource last modification (UTC) + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public System.DateTime? LastModifiedAt { get; set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/TrackedResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/TrackedResource.cs index f76bdf2825ec..82b1d40a79f5 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/TrackedResource.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/TrackedResource.cs @@ -17,8 +17,12 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models using System.Linq; /// - /// The resource model definition for a ARM tracked top level resource + /// Tracked Resource /// + /// + /// The resource model definition for an Azure Resource Manager tracked top + /// level resource which has 'tags' and a 'location' + /// public partial class TrackedResource : Resource { /// @@ -34,12 +38,12 @@ public TrackedResource() /// /// The geo-location where the resource /// lives - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// Resource tags. public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) : base(id, name, type) diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VcoreCapability.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VcoreCapability.cs new file mode 100644 index 000000000000..b41ad3f77b3e --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VcoreCapability.cs @@ -0,0 +1,76 @@ +// +// 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.PostgreSQL.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Vcores capability + /// + public partial class VcoreCapability + { + /// + /// Initializes a new instance of the VcoreCapability class. + /// + public VcoreCapability() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VcoreCapability class. + /// + /// vCore name + /// supported vCores + /// supported IOPS + /// supported memory per vCore + /// in MB + public VcoreCapability(string name = default(string), long? vCores = default(long?), long? supportedIops = default(long?), long? supportedMemoryPerVcoreMB = default(long?)) + { + Name = name; + VCores = vCores; + SupportedIops = supportedIops; + SupportedMemoryPerVcoreMB = supportedMemoryPerVcoreMB; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets vCore name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets supported vCores + /// + [JsonProperty(PropertyName = "vCores")] + public long? VCores { get; private set; } + + /// + /// Gets supported IOPS + /// + [JsonProperty(PropertyName = "supportedIops")] + public long? SupportedIops { get; private set; } + + /// + /// Gets supported memory per vCore in MB + /// + [JsonProperty(PropertyName = "supportedMemoryPerVcoreMB")] + public long? SupportedMemoryPerVcoreMB { get; private set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkRule.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkRule.cs deleted file mode 100644 index cffba1a1967d..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkRule.cs +++ /dev/null @@ -1,97 +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.PostgreSQL.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// A virtual network rule. - /// - [Rest.Serialization.JsonTransformation] - public partial class VirtualNetworkRule : ProxyResource - { - /// - /// Initializes a new instance of the VirtualNetworkRule class. - /// - public VirtualNetworkRule() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the VirtualNetworkRule class. - /// - /// The ARM resource id of the - /// virtual network subnet. - /// Fully qualified resource Id for the resource. Ex - - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. - /// Create firewall rule - /// before the virtual network has vnet service endpoint - /// enabled. - /// Virtual Network Rule State. Possible values - /// include: 'Initializing', 'InProgress', 'Ready', 'Deleting', - /// 'Unknown' - public VirtualNetworkRule(string virtualNetworkSubnetId, string id = default(string), string name = default(string), string type = default(string), bool? ignoreMissingVnetServiceEndpoint = default(bool?), string state = default(string)) - : base(id, name, type) - { - VirtualNetworkSubnetId = virtualNetworkSubnetId; - IgnoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint; - State = state; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the ARM resource id of the virtual network subnet. - /// - [JsonProperty(PropertyName = "properties.virtualNetworkSubnetId")] - public string VirtualNetworkSubnetId { get; set; } - - /// - /// Gets or sets create firewall rule before the virtual network has - /// vnet service endpoint enabled. - /// - [JsonProperty(PropertyName = "properties.ignoreMissingVnetServiceEndpoint")] - public bool? IgnoreMissingVnetServiceEndpoint { get; set; } - - /// - /// Gets virtual Network Rule State. Possible values include: - /// 'Initializing', 'InProgress', 'Ready', 'Deleting', 'Unknown' - /// - [JsonProperty(PropertyName = "properties.state")] - public string State { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (VirtualNetworkSubnetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "VirtualNetworkSubnetId"); - } - } - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkRuleState.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkRuleState.cs deleted file mode 100644 index c193d20d2a34..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkRuleState.cs +++ /dev/null @@ -1,25 +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.PostgreSQL.Models -{ - - /// - /// Defines values for VirtualNetworkRuleState. - /// - public static class VirtualNetworkRuleState - { - public const string Initializing = "Initializing"; - public const string InProgress = "InProgress"; - public const string Ready = "Ready"; - public const string Deleting = "Deleting"; - public const string Unknown = "Unknown"; - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkSubnetUsageParameter.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkSubnetUsageParameter.cs new file mode 100644 index 000000000000..5919e7cebf60 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkSubnetUsageParameter.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Virtual network subnet usage parameter + /// + public partial class VirtualNetworkSubnetUsageParameter + { + /// + /// Initializes a new instance of the + /// VirtualNetworkSubnetUsageParameter class. + /// + public VirtualNetworkSubnetUsageParameter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VirtualNetworkSubnetUsageParameter class. + /// + /// Virtual network resource + /// id. + public VirtualNetworkSubnetUsageParameter(string virtualNetworkArmResourceId = default(string)) + { + VirtualNetworkArmResourceId = virtualNetworkArmResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets virtual network resource id. + /// + [JsonProperty(PropertyName = "virtualNetworkArmResourceId")] + public string VirtualNetworkArmResourceId { get; set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateEndpointProperty.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkSubnetUsageResult.cs similarity index 52% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateEndpointProperty.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkSubnetUsageResult.cs index 505e7303626e..9aaa4f92d69c 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateEndpointProperty.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkSubnetUsageResult.cs @@ -10,28 +10,32 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models { - using Microsoft.Rest; - using Microsoft.Rest.Azure; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; - public partial class PrivateEndpointProperty : IResource + /// + /// Virtual network subnet usage data. + /// + public partial class VirtualNetworkSubnetUsageResult { /// - /// Initializes a new instance of the PrivateEndpointProperty class. + /// Initializes a new instance of the VirtualNetworkSubnetUsageResult + /// class. /// - public PrivateEndpointProperty() + public VirtualNetworkSubnetUsageResult() { CustomInit(); } /// - /// Initializes a new instance of the PrivateEndpointProperty class. + /// Initializes a new instance of the VirtualNetworkSubnetUsageResult + /// class. /// - /// Resource id of the private endpoint. - public PrivateEndpointProperty(string id = default(string)) + public VirtualNetworkSubnetUsageResult(IList delegatedSubnetsUsage = default(IList)) { - Id = id; + DelegatedSubnetsUsage = delegatedSubnetsUsage; CustomInit(); } @@ -41,10 +45,9 @@ public PrivateEndpointProperty() partial void CustomInit(); /// - /// Gets or sets resource id of the private endpoint. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [JsonProperty(PropertyName = "delegatedSubnetsUsage")] + public IList DelegatedSubnetsUsage { get; private set; } } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Operations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Operations.cs index e27b3730208b..a457e7666db0 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Operations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Operations.cs @@ -65,12 +65,28 @@ internal Operations(PostgreSQLManagementClient client) /// /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - string apiVersion = "2017-12-01"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -78,17 +94,16 @@ internal Operations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); 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.DBForPostgreSQL/operations").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.DBForPostgreSql/operations").ToString(); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PostgreSQLManagementClient.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PostgreSQLManagementClient.cs index 0c38d863f8a7..749c19a8ba9b 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PostgreSQLManagementClient.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PostgreSQLManagementClient.cs @@ -49,6 +49,11 @@ public partial class PostgreSQLManagementClient : ServiceClient public ServiceClientCredentials Credentials { get; private set; } + /// + /// The API version to use for this operation. + /// + public string ApiVersion { get; private set; } + /// /// The ID of the target subscription. /// @@ -77,75 +82,45 @@ public partial class PostgreSQLManagementClient : ServiceClient public virtual IServersOperations Servers { get; private set; } - /// - /// Gets the IReplicasOperations. - /// - public virtual IReplicasOperations Replicas { get; private set; } - /// /// Gets the IFirewallRulesOperations. /// public virtual IFirewallRulesOperations FirewallRules { get; private set; } - /// - /// Gets the IVirtualNetworkRulesOperations. - /// - public virtual IVirtualNetworkRulesOperations VirtualNetworkRules { get; private set; } - - /// - /// Gets the IDatabasesOperations. - /// - public virtual IDatabasesOperations Databases { get; private set; } - /// /// Gets the IConfigurationsOperations. /// public virtual IConfigurationsOperations Configurations { get; private set; } - /// - /// Gets the ILogFilesOperations. - /// - public virtual ILogFilesOperations LogFiles { get; private set; } - - /// - /// Gets the IServerAdministratorsOperations. - /// - public virtual IServerAdministratorsOperations ServerAdministrators { get; private set; } - - /// - /// Gets the ILocationBasedPerformanceTierOperations. - /// - public virtual ILocationBasedPerformanceTierOperations LocationBasedPerformanceTier { get; private set; } - /// /// Gets the ICheckNameAvailabilityOperations. /// public virtual ICheckNameAvailabilityOperations CheckNameAvailability { get; private set; } /// - /// Gets the IOperations. + /// Gets the ILocationBasedCapabilitiesOperations. /// - public virtual IOperations Operations { get; private set; } + public virtual ILocationBasedCapabilitiesOperations LocationBasedCapabilities { get; private set; } /// - /// Gets the IServerSecurityAlertPoliciesOperations. + /// Gets the IVirtualNetworkSubnetUsageOperations. /// - public virtual IServerSecurityAlertPoliciesOperations ServerSecurityAlertPolicies { get; private set; } + public virtual IVirtualNetworkSubnetUsageOperations VirtualNetworkSubnetUsage { get; private set; } /// - /// Gets the IPrivateEndpointConnectionsOperations. + /// Gets the IOperations. /// - public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } + public virtual IOperations Operations { get; private set; } /// - /// Gets the IPrivateLinkResourcesOperations. + /// Gets the IDatabasesOperations. /// - public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } + public virtual IDatabasesOperations Databases { get; private set; } /// - /// Gets the IServerKeysOperations. + /// Gets the IGetPrivateDnsZoneSuffixOperations. /// - public virtual IServerKeysOperations ServerKeys { get; private set; } + public virtual IGetPrivateDnsZoneSuffixOperations GetPrivateDnsZoneSuffix { get; private set; } /// /// Initializes a new instance of the PostgreSQLManagementClient class. @@ -389,21 +364,16 @@ public PostgreSQLManagementClient(System.Uri baseUri, ServiceClientCredentials c private void Initialize() { Servers = new ServersOperations(this); - Replicas = new ReplicasOperations(this); FirewallRules = new FirewallRulesOperations(this); - VirtualNetworkRules = new VirtualNetworkRulesOperations(this); - Databases = new DatabasesOperations(this); Configurations = new ConfigurationsOperations(this); - LogFiles = new LogFilesOperations(this); - ServerAdministrators = new ServerAdministratorsOperations(this); - LocationBasedPerformanceTier = new LocationBasedPerformanceTierOperations(this); CheckNameAvailability = new CheckNameAvailabilityOperations(this); + LocationBasedCapabilities = new LocationBasedCapabilitiesOperations(this); + VirtualNetworkSubnetUsage = new VirtualNetworkSubnetUsageOperations(this); Operations = new Operations(this); - ServerSecurityAlertPolicies = new ServerSecurityAlertPoliciesOperations(this); - PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); - PrivateLinkResources = new PrivateLinkResourcesOperations(this); - ServerKeys = new ServerKeysOperations(this); + Databases = new DatabasesOperations(this); + GetPrivateDnsZoneSuffix = new GetPrivateDnsZoneSuffixOperations(this); BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2021-06-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; @@ -433,8 +403,6 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("createMode")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("createMode")); CustomInitialize(); DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PrivateEndpointConnectionsOperations.cs deleted file mode 100644 index ce6bec612f89..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PrivateEndpointConnectionsOperations.cs +++ /dev/null @@ -1,1435 +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.PostgreSQL -{ - 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; - - /// - /// PrivateEndpointConnectionsOperations operations. - /// - internal partial class PrivateEndpointConnectionsOperations : IServiceOperations, IPrivateEndpointConnectionsOperations - { - /// - /// Initializes a new instance of the PrivateEndpointConnectionsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal PrivateEndpointConnectionsOperations(PostgreSQLManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the PostgreSQLManagementClient - /// - public PostgreSQLManagementClient Client { get; private set; } - - /// - /// Gets a private endpoint connection. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (privateEndpointConnectionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - string apiVersion = "2018-06-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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; - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, privateEndpointConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Updates tags on private endpoint connection. - /// - /// - /// Updates private endpoint connection with the specified tags. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// Parameters supplied to the Update private endpoint connection Tags - /// operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string serverName, string privateEndpointConnectionName, TagsObject parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginUpdateTagsWithHttpMessagesAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets all private endpoint connections on a server. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// 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>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - string apiVersion = "2018-06-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServer", 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.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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; - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// - /// - /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (privateEndpointConnectionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - string apiVersion = "2018-06-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", 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.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (privateEndpointConnectionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - string apiVersion = "2018-06-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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; - } - - /// - /// Updates tags on private endpoint connection. - /// - /// - /// Updates private endpoint connection with the specified tags. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// Parameters supplied to the Update private endpoint connection Tags - /// 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> BeginUpdateTagsWithHttpMessagesAsync(string resourceGroupName, string serverName, string privateEndpointConnectionName, TagsObject parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (privateEndpointConnectionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - string apiVersion = "2018-06-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginUpdateTags", 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.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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("PATCH"); - _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) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 all private endpoint connections on a server. - /// - /// - /// 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>> ListByServerNextWithHttpMessagesAsync(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, "ListByServerNext", 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PrivateEndpointConnectionsOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PrivateEndpointConnectionsOperationsExtensions.cs deleted file mode 100644 index 2d26956c7dc8..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PrivateEndpointConnectionsOperationsExtensions.cs +++ /dev/null @@ -1,439 +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.PostgreSQL -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for PrivateEndpointConnectionsOperations. - /// - public static partial class PrivateEndpointConnectionsOperationsExtensions - { - /// - /// Gets a private endpoint connection. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the private endpoint connection. - /// - public static PrivateEndpointConnection Get(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string serverName, string privateEndpointConnectionName) - { - return operations.GetAsync(resourceGroupName, serverName, privateEndpointConnectionName).GetAwaiter().GetResult(); - } - - /// - /// Gets a private endpoint connection. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string serverName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// - public static PrivateEndpointConnection CreateOrUpdate(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string serverName, string privateEndpointConnectionName, PrivateEndpointConnection parameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string serverName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - public static void Delete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string serverName, string privateEndpointConnectionName) - { - operations.DeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName).GetAwaiter().GetResult(); - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string serverName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Updates tags on private endpoint connection. - /// - /// - /// Updates private endpoint connection with the specified tags. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// Parameters supplied to the Update private endpoint connection Tags - /// operation. - /// - public static PrivateEndpointConnection UpdateTags(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string serverName, string privateEndpointConnectionName, TagsObject parameters) - { - return operations.UpdateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Updates tags on private endpoint connection. - /// - /// - /// Updates private endpoint connection with the specified tags. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// Parameters supplied to the Update private endpoint connection Tags - /// operation. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateTagsAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string serverName, string privateEndpointConnectionName, TagsObject parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateTagsWithHttpMessagesAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets all private endpoint connections on a server. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - public static IPage ListByServer(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string serverName) - { - return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); - } - - /// - /// Gets all private endpoint connections on a server. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByServerAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// - public static PrivateEndpointConnection BeginCreateOrUpdate(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string serverName, string privateEndpointConnectionName, PrivateEndpointConnection parameters) - { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string serverName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - public static void BeginDelete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string serverName, string privateEndpointConnectionName) - { - operations.BeginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName).GetAwaiter().GetResult(); - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string serverName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Updates tags on private endpoint connection. - /// - /// - /// Updates private endpoint connection with the specified tags. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// Parameters supplied to the Update private endpoint connection Tags - /// operation. - /// - public static PrivateEndpointConnection BeginUpdateTags(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string serverName, string privateEndpointConnectionName, TagsObject parameters) - { - return operations.BeginUpdateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Updates tags on private endpoint connection. - /// - /// - /// Updates private endpoint connection with the specified tags. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// - /// - /// Parameters supplied to the Update private endpoint connection Tags - /// operation. - /// - /// - /// The cancellation token. - /// - public static async Task BeginUpdateTagsAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string serverName, string privateEndpointConnectionName, TagsObject parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginUpdateTagsWithHttpMessagesAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets all private endpoint connections on a server. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByServerNext(this IPrivateEndpointConnectionsOperations operations, string nextPageLink) - { - return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets all private endpoint connections on a server. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByServerNextAsync(this IPrivateEndpointConnectionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PrivateLinkResourcesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PrivateLinkResourcesOperations.cs deleted file mode 100644 index 39f329b8db20..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PrivateLinkResourcesOperations.cs +++ /dev/null @@ -1,668 +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.PostgreSQL -{ - 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; - - /// - /// PrivateLinkResourcesOperations operations. - /// - internal partial class PrivateLinkResourcesOperations : IServiceOperations, IPrivateLinkResourcesOperations - { - /// - /// Initializes a new instance of the PrivateLinkResourcesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal PrivateLinkResourcesOperations(PostgreSQLManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the PostgreSQLManagementClient - /// - public PostgreSQLManagementClient Client { get; private set; } - - /// - /// Gets the private link resources for PostgreSQL server. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// 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>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - string apiVersion = "2018-06-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServer", 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.DBforPostgreSQL/servers/{serverName}/privateLinkResources").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 a private link resource for PostgreSQL server. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the private link resource. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (groupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "groupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - string apiVersion = "2018-06-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("groupName", groupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateLinkResources/{groupName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{groupName}", System.Uri.EscapeDataString(groupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets the private link resources for PostgreSQL server. - /// - /// - /// 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>> ListByServerNextWithHttpMessagesAsync(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, "ListByServerNext", 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PrivateLinkResourcesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PrivateLinkResourcesOperationsExtensions.cs deleted file mode 100644 index e274e4b97ab0..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PrivateLinkResourcesOperationsExtensions.cs +++ /dev/null @@ -1,145 +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.PostgreSQL -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for PrivateLinkResourcesOperations. - /// - public static partial class PrivateLinkResourcesOperationsExtensions - { - /// - /// Gets the private link resources for PostgreSQL server. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - public static IPage ListByServer(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string serverName) - { - return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); - } - - /// - /// Gets the private link resources for PostgreSQL server. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByServerAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a private link resource for PostgreSQL server. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the private link resource. - /// - public static PrivateLinkResource Get(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string serverName, string groupName) - { - return operations.GetAsync(resourceGroupName, serverName, groupName).GetAwaiter().GetResult(); - } - - /// - /// Gets a private link resource for PostgreSQL server. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the private link resource. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string serverName, string groupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, groupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the private link resources for PostgreSQL server. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByServerNext(this IPrivateLinkResourcesOperations operations, string nextPageLink) - { - return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets the private link resources for PostgreSQL server. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByServerNextAsync(this IPrivateLinkResourcesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ReplicasOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ReplicasOperations.cs deleted file mode 100644 index 3dc09ffea742..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ReplicasOperations.cs +++ /dev/null @@ -1,270 +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.PostgreSQL -{ - 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; - - /// - /// ReplicasOperations operations. - /// - internal partial class ReplicasOperations : IServiceOperations, IReplicasOperations - { - /// - /// Initializes a new instance of the ReplicasOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ReplicasOperations(PostgreSQLManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the PostgreSQLManagementClient - /// - public PostgreSQLManagementClient Client { get; private set; } - - /// - /// List all the replicas for a given server. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// 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>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - string apiVersion = "2017-12-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServer", 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.DBForPostgreSQL/servers/{serverName}/Replicas").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ReplicasOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ReplicasOperationsExtensions.cs deleted file mode 100644 index 6e80270ae710..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ReplicasOperationsExtensions.cs +++ /dev/null @@ -1,67 +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.PostgreSQL -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ReplicasOperations. - /// - public static partial class ReplicasOperationsExtensions - { - /// - /// List all the replicas for a given server. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - public static IEnumerable ListByServer(this IReplicasOperations operations, string resourceGroupName, string serverName) - { - return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); - } - - /// - /// List all the replicas for a given server. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByServerAsync(this IReplicasOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/SdkInfo_PostgreSQLManagementClient.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/SdkInfo_PostgreSQLManagementClient.cs index 91c35835f585..1112daf70bc9 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/SdkInfo_PostgreSQLManagementClient.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/SdkInfo_PostgreSQLManagementClient.cs @@ -19,34 +19,17 @@ public static IEnumerable> ApiInfo_PostgreSQLManag { return new Tuple[] { - new Tuple("DBForPostgreSQL", "CheckNameAvailability", "2017-12-01"), - new Tuple("DBForPostgreSQL", "Configurations", "2017-12-01"), - new Tuple("DBForPostgreSQL", "Databases", "2017-12-01"), - new Tuple("DBForPostgreSQL", "FirewallRules", "2017-12-01"), - new Tuple("DBForPostgreSQL", "LocationBasedPerformanceTier", "2017-12-01"), - new Tuple("DBForPostgreSQL", "LogFiles", "2017-12-01"), - new Tuple("DBForPostgreSQL", "Operations", "2017-12-01"), - new Tuple("DBForPostgreSQL", "Replicas", "2017-12-01"), - new Tuple("DBForPostgreSQL", "ServerAdministrators", "2017-12-01"), - new Tuple("DBForPostgreSQL", "Servers", "2017-12-01"), - new Tuple("DBForPostgreSQL", "VirtualNetworkRules", "2017-12-01"), - new Tuple("DBforPostgreSQL", "PrivateEndpointConnections", "2018-06-01"), - new Tuple("DBforPostgreSQL", "PrivateLinkResources", "2018-06-01"), - new Tuple("DBforPostgreSQL", "ServerKeys", "2020-01-01"), - new Tuple("DBforPostgreSQL", "ServerSecurityAlertPolicies", "2017-12-01"), + new Tuple("DBForPostgreSql", "CheckNameAvailability", "2021-06-01"), + new Tuple("DBForPostgreSql", "Configurations", "2021-06-01"), + new Tuple("DBForPostgreSql", "Databases", "2021-06-01"), + new Tuple("DBForPostgreSql", "FirewallRules", "2021-06-01"), + new Tuple("DBForPostgreSql", "GetPrivateDnsZoneSuffix", "2021-06-01"), + new Tuple("DBForPostgreSql", "LocationBasedCapabilities", "2021-06-01"), + new Tuple("DBForPostgreSql", "Operations", "2021-06-01"), + new Tuple("DBForPostgreSql", "Servers", "2021-06-01"), + new Tuple("DBForPostgreSql", "VirtualNetworkSubnetUsage", "2021-06-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/postgresql/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp.output-folder=C:\\z\\azure-sdk-for-net\\sdk\\postgresql\\Microsoft.Azure.Management.PostgreSQL\\src\\postgresql\\Generated"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "faf8e1c19e3b36e6d16622bf168369a838b04a7f"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerAdministratorsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerAdministratorsOperations.cs deleted file mode 100644 index a8aa258bcde2..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerAdministratorsOperations.cs +++ /dev/null @@ -1,984 +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.PostgreSQL -{ - 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; - - /// - /// ServerAdministratorsOperations operations. - /// - internal partial class ServerAdministratorsOperations : IServiceOperations, IServerAdministratorsOperations - { - /// - /// Initializes a new instance of the ServerAdministratorsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ServerAdministratorsOperations(PostgreSQLManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the PostgreSQLManagementClient - /// - public PostgreSQLManagementClient Client { get; private set; } - - /// - /// Gets information about a AAD server administrator. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - string apiVersion = "2017-12-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/Administrators/activeDirectory").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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; - } - - /// - /// Creates or update active directory administrator on an existing server. The - /// update action will overwrite the existing administrator. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The required parameters for creating or updating an AAD server - /// administrator. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerAdministratorResource properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, properties, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes server active directory administrator. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Returns a list of server Administrators. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// 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 serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - string apiVersion = "2017-12-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - 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.DBForPostgreSQL/servers/{serverName}/administrators").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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; - } - - /// - /// Creates or update active directory administrator on an existing server. The - /// update action will overwrite the existing administrator. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The required parameters for creating or updating an AAD server - /// administrator. - /// - /// - /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerAdministratorResource properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (properties == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "properties"); - } - if (properties != null) - { - properties.Validate(); - } - string apiVersion = "2017-12-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("properties", properties); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", 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.DBForPostgreSQL/servers/{serverName}/Administrators/activeDirectory").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(properties != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(properties, 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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); - } - } - // Deserialize Response - if ((int)_statusCode == 202) - { - _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 server active directory administrator. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - string apiVersion = "2017-12-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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.DBForPostgreSQL/servers/{serverName}/Administrators/activeDirectory").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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; - } - - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerAdministratorsOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerAdministratorsOperationsExtensions.cs deleted file mode 100644 index e8d55f93089c..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerAdministratorsOperationsExtensions.cs +++ /dev/null @@ -1,281 +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.PostgreSQL -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ServerAdministratorsOperations. - /// - public static partial class ServerAdministratorsOperationsExtensions - { - /// - /// Gets information about a AAD server administrator. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - public static ServerAdministratorResource Get(this IServerAdministratorsOperations operations, string resourceGroupName, string serverName) - { - return operations.GetAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); - } - - /// - /// Gets information about a AAD server administrator. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IServerAdministratorsOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates or update active directory administrator on an existing server. The - /// update action will overwrite the existing administrator. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The required parameters for creating or updating an AAD server - /// administrator. - /// - public static ServerAdministratorResource CreateOrUpdate(this IServerAdministratorsOperations operations, string resourceGroupName, string serverName, ServerAdministratorResource properties) - { - return operations.CreateOrUpdateAsync(resourceGroupName, serverName, properties).GetAwaiter().GetResult(); - } - - /// - /// Creates or update active directory administrator on an existing server. The - /// update action will overwrite the existing administrator. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The required parameters for creating or updating an AAD server - /// administrator. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IServerAdministratorsOperations operations, string resourceGroupName, string serverName, ServerAdministratorResource properties, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, properties, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes server active directory administrator. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - public static void Delete(this IServerAdministratorsOperations operations, string resourceGroupName, string serverName) - { - operations.DeleteAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); - } - - /// - /// Deletes server active directory administrator. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IServerAdministratorsOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Returns a list of server Administrators. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - public static IEnumerable List(this IServerAdministratorsOperations operations, string resourceGroupName, string serverName) - { - return operations.ListAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of server Administrators. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IServerAdministratorsOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates or update active directory administrator on an existing server. The - /// update action will overwrite the existing administrator. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The required parameters for creating or updating an AAD server - /// administrator. - /// - public static ServerAdministratorResource BeginCreateOrUpdate(this IServerAdministratorsOperations operations, string resourceGroupName, string serverName, ServerAdministratorResource properties) - { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, serverName, properties).GetAwaiter().GetResult(); - } - - /// - /// Creates or update active directory administrator on an existing server. The - /// update action will overwrite the existing administrator. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The required parameters for creating or updating an AAD server - /// administrator. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IServerAdministratorsOperations operations, string resourceGroupName, string serverName, ServerAdministratorResource properties, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, properties, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes server active directory administrator. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - public static void BeginDelete(this IServerAdministratorsOperations operations, string resourceGroupName, string serverName) - { - operations.BeginDeleteAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); - } - - /// - /// Deletes server active directory administrator. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IServerAdministratorsOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerKeysOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerKeysOperations.cs deleted file mode 100644 index c47ec054c22e..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerKeysOperations.cs +++ /dev/null @@ -1,1184 +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.PostgreSQL -{ - 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; - - /// - /// ServerKeysOperations operations. - /// - internal partial class ServerKeysOperations : IServiceOperations, IServerKeysOperations - { - /// - /// Initializes a new instance of the ServerKeysOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ServerKeysOperations(PostgreSQLManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the PostgreSQLManagementClient - /// - public PostgreSQLManagementClient Client { get; private set; } - - /// - /// Gets a list of Server keys. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// 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 serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - 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.DBforPostgreSQL/servers/{serverName}/keys").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 a PostgreSQL Server key. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be retrieved. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string keyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (keyName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "keyName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("keyName", keyName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{keyName}", System.Uri.EscapeDataString(keyName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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; - } - - /// - /// Creates or updates a PostgreSQL Server key. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be operated on (updated or - /// created). - /// - /// - /// The requested PostgreSQL Server key resource state. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string serverName, string keyName, ServerKey parameters, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(serverName, keyName, parameters, resourceGroupName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes the PostgreSQL Server key with the given name. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be deleted. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string serverName, string keyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(serverName, keyName, resourceGroupName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Creates or updates a PostgreSQL Server key. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be operated on (updated or - /// created). - /// - /// - /// The requested PostgreSQL Server key resource state. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string serverName, string keyName, ServerKey parameters, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (keyName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "keyName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("keyName", keyName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", 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.DBforPostgreSQL/servers/{serverName}/keys/{keyName}").ToString(); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{keyName}", System.Uri.EscapeDataString(keyName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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); - } - } - // Deserialize Response - if ((int)_statusCode == 202) - { - _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 the PostgreSQL Server key with the given name. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be deleted. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// 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 BeginDeleteWithHttpMessagesAsync(string serverName, string keyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (keyName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "keyName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("keyName", keyName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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.DBforPostgreSQL/servers/{serverName}/keys/{keyName}").ToString(); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{keyName}", System.Uri.EscapeDataString(keyName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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; - } - - /// - /// Gets a list of Server keys. - /// - /// - /// 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerKeysOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerKeysOperationsExtensions.cs deleted file mode 100644 index cbcd8adb0b4c..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerKeysOperationsExtensions.cs +++ /dev/null @@ -1,339 +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.PostgreSQL -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ServerKeysOperations. - /// - public static partial class ServerKeysOperationsExtensions - { - /// - /// Gets a list of Server keys. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - public static IPage List(this IServerKeysOperations operations, string resourceGroupName, string serverName) - { - return operations.ListAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of Server keys. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IServerKeysOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a PostgreSQL Server key. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be retrieved. - /// - public static ServerKey Get(this IServerKeysOperations operations, string resourceGroupName, string serverName, string keyName) - { - return operations.GetAsync(resourceGroupName, serverName, keyName).GetAwaiter().GetResult(); - } - - /// - /// Gets a PostgreSQL Server key. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be retrieved. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IServerKeysOperations operations, string resourceGroupName, string serverName, string keyName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, keyName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates or updates a PostgreSQL Server key. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be operated on (updated or - /// created). - /// - /// - /// The requested PostgreSQL Server key resource state. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - public static ServerKey CreateOrUpdate(this IServerKeysOperations operations, string serverName, string keyName, ServerKey parameters, string resourceGroupName) - { - return operations.CreateOrUpdateAsync(serverName, keyName, parameters, resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates a PostgreSQL Server key. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be operated on (updated or - /// created). - /// - /// - /// The requested PostgreSQL Server key resource state. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IServerKeysOperations operations, string serverName, string keyName, ServerKey parameters, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(serverName, keyName, parameters, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes the PostgreSQL Server key with the given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be deleted. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - public static void Delete(this IServerKeysOperations operations, string serverName, string keyName, string resourceGroupName) - { - operations.DeleteAsync(serverName, keyName, resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Deletes the PostgreSQL Server key with the given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be deleted. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IServerKeysOperations operations, string serverName, string keyName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(serverName, keyName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Creates or updates a PostgreSQL Server key. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be operated on (updated or - /// created). - /// - /// - /// The requested PostgreSQL Server key resource state. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - public static ServerKey BeginCreateOrUpdate(this IServerKeysOperations operations, string serverName, string keyName, ServerKey parameters, string resourceGroupName) - { - return operations.BeginCreateOrUpdateAsync(serverName, keyName, parameters, resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates a PostgreSQL Server key. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be operated on (updated or - /// created). - /// - /// - /// The requested PostgreSQL Server key resource state. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IServerKeysOperations operations, string serverName, string keyName, ServerKey parameters, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(serverName, keyName, parameters, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes the PostgreSQL Server key with the given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be deleted. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - public static void BeginDelete(this IServerKeysOperations operations, string serverName, string keyName, string resourceGroupName) - { - operations.BeginDeleteAsync(serverName, keyName, resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Deletes the PostgreSQL Server key with the given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the server. - /// - /// - /// The name of the PostgreSQL Server key to be deleted. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IServerKeysOperations operations, string serverName, string keyName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(serverName, keyName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets a list of Server keys. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IServerKeysOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of Server keys. - /// - /// - /// 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 IServerKeysOperations 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/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperationsExtensions.cs deleted file mode 100644 index fa076ed76475..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperationsExtensions.cs +++ /dev/null @@ -1,157 +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.PostgreSQL -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ServerSecurityAlertPoliciesOperations. - /// - public static partial class ServerSecurityAlertPoliciesOperationsExtensions - { - /// - /// Get a server's security alert policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - public static ServerSecurityAlertPolicy Get(this IServerSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName) - { - return operations.GetAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); - } - - /// - /// Get a server's security alert policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IServerSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates or updates a threat detection policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The server security alert policy. - /// - public static ServerSecurityAlertPolicy CreateOrUpdate(this IServerSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName, ServerSecurityAlertPolicy parameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates a threat detection policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The server security alert policy. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IServerSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName, ServerSecurityAlertPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates or updates a threat detection policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The server security alert policy. - /// - public static ServerSecurityAlertPolicy BeginCreateOrUpdate(this IServerSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName, ServerSecurityAlertPolicy parameters) - { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates a threat detection policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The server security alert policy. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IServerSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName, ServerSecurityAlertPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServersOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServersOperations.cs index a7b8dd055e79..ab5991bfeb99 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServersOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServersOperations.cs @@ -51,7 +51,7 @@ internal ServersOperations(PostgreSQLManagementClient client) public PostgreSQLManagementClient Client { get; private set; } /// - /// Creates a new server, or will overwrite an existing server. + /// Creates a new server. /// /// /// The name of the resource group. The name is case insensitive. @@ -68,7 +68,7 @@ internal ServersOperations(PostgreSQLManagementClient client) /// /// The cancellation token. /// - public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerForCreate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string serverName, Server parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, serverName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); @@ -94,7 +94,7 @@ internal ServersOperations(PostgreSQLManagementClient client) /// /// The cancellation token. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerForUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, serverName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); @@ -155,6 +155,17 @@ internal ServersOperations(PostgreSQLManagementClient client) /// public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -189,7 +200,6 @@ internal ServersOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -197,7 +207,6 @@ internal ServersOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -205,14 +214,14 @@ internal ServersOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -366,8 +375,19 @@ internal ServersOperations(PostgreSQLManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -398,7 +418,6 @@ internal ServersOperations(PostgreSQLManagementClient client) throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); } } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -406,20 +425,19 @@ internal ServersOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", 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.DBForPostgreSQL/servers").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -514,7 +532,7 @@ internal ServersOperations(PostgreSQLManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -570,8 +588,19 @@ internal ServersOperations(PostgreSQLManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -583,7 +612,6 @@ internal ServersOperations(PostgreSQLManagementClient client) throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); } } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -591,18 +619,17 @@ internal ServersOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); 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.DBForPostgreSQL/servers").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DBForPostgreSql/flexibleServers").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -697,7 +724,7 @@ internal ServersOperations(PostgreSQLManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -738,21 +765,68 @@ internal ServersOperations(PostgreSQLManagementClient client) /// /// The name of the server. /// + /// + /// The parameters for restarting a server. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RestartWithHttpMessagesAsync(string resourceGroupName, string serverName, RestartParameter parameters = default(RestartParameter), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRestartWithHttpMessagesAsync(resourceGroupName, serverName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Starts a server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, serverName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Stops a server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - public async Task RestartWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task StopWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginRestartWithHttpMessagesAsync(resourceGroupName, serverName, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(resourceGroupName, serverName, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Creates a new server, or will overwrite an existing server. + /// Creates a new server. /// /// /// The name of the resource group. The name is case insensitive. @@ -784,8 +858,19 @@ internal ServersOperations(PostgreSQLManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerForCreate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string serverName, Server parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -828,7 +913,6 @@ internal ServersOperations(PostgreSQLManagementClient client) { parameters.Validate(); } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -836,7 +920,6 @@ internal ServersOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("parameters", parameters); @@ -845,14 +928,14 @@ internal ServersOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1037,8 +1120,19 @@ internal ServersOperations(PostgreSQLManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerForUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1077,7 +1171,6 @@ internal ServersOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1085,7 +1178,6 @@ internal ServersOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("parameters", parameters); @@ -1094,14 +1186,14 @@ internal ServersOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1263,6 +1355,17 @@ internal ServersOperations(PostgreSQLManagementClient client) /// public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1297,7 +1400,6 @@ internal ServersOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1305,7 +1407,6 @@ internal ServersOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -1313,14 +1414,14 @@ internal ServersOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1438,6 +1539,9 @@ internal ServersOperations(PostgreSQLManagementClient client) /// /// The name of the server. /// + /// + /// The parameters for restarting a server. + /// /// /// Headers that will be added to request. /// @@ -1456,8 +1560,19 @@ internal ServersOperations(PostgreSQLManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string serverName, RestartParameter parameters = default(RestartParameter), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1492,7 +1607,6 @@ internal ServersOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1500,22 +1614,22 @@ internal ServersOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginRestart", 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.DBForPostgreSQL/servers/{serverName}/restart").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{serverName}/restart").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1555,6 +1669,12 @@ internal ServersOperations(PostgreSQLManagementClient client) // 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) { @@ -1624,5 +1744,759 @@ internal ServersOperations(PostgreSQLManagementClient client) return _result; } + /// + /// Starts a server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// 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 BeginStartWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStart", 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.DBForPostgreSql/flexibleServers/{serverName}/start").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + 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 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + 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; + } + + /// + /// Stops a server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// 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 BeginStopWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStop", 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.DBForPostgreSql/flexibleServers/{serverName}/stop").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + 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 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + 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; + } + + /// + /// List all the servers in a given resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List all the servers in a given subscription. + /// + /// + /// 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + 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/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServersOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServersOperationsExtensions.cs index c3e2c002f68e..3620f35800ac 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServersOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServersOperationsExtensions.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.PostgreSQL using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -24,7 +22,7 @@ namespace Microsoft.Azure.Management.PostgreSQL public static partial class ServersOperationsExtensions { /// - /// Creates a new server, or will overwrite an existing server. + /// Creates a new server. /// /// /// The operations group for this extension method. @@ -38,13 +36,13 @@ public static partial class ServersOperationsExtensions /// /// The required parameters for creating or updating a server. /// - public static Server Create(this IServersOperations operations, string resourceGroupName, string serverName, ServerForCreate parameters) + public static Server Create(this IServersOperations operations, string resourceGroupName, string serverName, Server parameters) { return operations.CreateAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); } /// - /// Creates a new server, or will overwrite an existing server. + /// Creates a new server. /// /// /// The operations group for this extension method. @@ -61,7 +59,7 @@ public static Server Create(this IServersOperations operations, string resourceG /// /// The cancellation token. /// - public static async Task CreateAsync(this IServersOperations operations, string resourceGroupName, string serverName, ServerForCreate parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateAsync(this IServersOperations operations, string resourceGroupName, string serverName, Server parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -85,7 +83,7 @@ public static Server Create(this IServersOperations operations, string resourceG /// /// The required parameters for updating a server. /// - public static Server Update(this IServersOperations operations, string resourceGroupName, string serverName, ServerUpdateParameters parameters) + public static Server Update(this IServersOperations operations, string resourceGroupName, string serverName, ServerForUpdate parameters) { return operations.UpdateAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); } @@ -109,7 +107,7 @@ public static Server Update(this IServersOperations operations, string resourceG /// /// The cancellation token. /// - public static async Task UpdateAsync(this IServersOperations operations, string resourceGroupName, string serverName, ServerUpdateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IServersOperations operations, string resourceGroupName, string serverName, ServerForUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -203,7 +201,7 @@ public static Server Get(this IServersOperations operations, string resourceGrou /// /// The name of the resource group. The name is case insensitive. /// - public static IEnumerable ListByResourceGroup(this IServersOperations operations, string resourceGroupName) + public static IPage ListByResourceGroup(this IServersOperations operations, string resourceGroupName) { return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); } @@ -220,7 +218,7 @@ public static IEnumerable ListByResourceGroup(this IServersOperations op /// /// The cancellation token. /// - public static async Task> ListByResourceGroupAsync(this IServersOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceGroupAsync(this IServersOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) { @@ -234,7 +232,7 @@ public static IEnumerable ListByResourceGroup(this IServersOperations op /// /// The operations group for this extension method. /// - public static IEnumerable List(this IServersOperations operations) + public static IPage List(this IServersOperations operations) { return operations.ListAsync().GetAwaiter().GetResult(); } @@ -248,7 +246,7 @@ public static IEnumerable List(this IServersOperations operations) /// /// The cancellation token. /// - public static async Task> ListAsync(this IServersOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IServersOperations operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { @@ -268,9 +266,12 @@ public static IEnumerable List(this IServersOperations operations) /// /// The name of the server. /// - public static void Restart(this IServersOperations operations, string resourceGroupName, string serverName) + /// + /// The parameters for restarting a server. + /// + public static void Restart(this IServersOperations operations, string resourceGroupName, string serverName, RestartParameter parameters = default(RestartParameter)) { - operations.RestartAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + operations.RestartAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); } /// @@ -285,16 +286,93 @@ public static void Restart(this IServersOperations operations, string resourceGr /// /// The name of the server. /// + /// + /// The parameters for restarting a server. + /// + /// + /// The cancellation token. + /// + public static async Task RestartAsync(this IServersOperations operations, string resourceGroupName, string serverName, RestartParameter parameters = default(RestartParameter), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RestartWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + public static void Start(this IServersOperations operations, string resourceGroupName, string serverName) + { + operations.StartAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// Starts a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The cancellation token. + /// + public static async Task StartAsync(this IServersOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Stops a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + public static void Stop(this IServersOperations operations, string resourceGroupName, string serverName) + { + operations.StopAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// Stops a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// /// /// The cancellation token. /// - public static async Task RestartAsync(this IServersOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task StopAsync(this IServersOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.RestartWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.StopWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Creates a new server, or will overwrite an existing server. + /// Creates a new server. /// /// /// The operations group for this extension method. @@ -308,13 +386,13 @@ public static void Restart(this IServersOperations operations, string resourceGr /// /// The required parameters for creating or updating a server. /// - public static Server BeginCreate(this IServersOperations operations, string resourceGroupName, string serverName, ServerForCreate parameters) + public static Server BeginCreate(this IServersOperations operations, string resourceGroupName, string serverName, Server parameters) { return operations.BeginCreateAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); } /// - /// Creates a new server, or will overwrite an existing server. + /// Creates a new server. /// /// /// The operations group for this extension method. @@ -331,7 +409,7 @@ public static Server BeginCreate(this IServersOperations operations, string reso /// /// The cancellation token. /// - public static async Task BeginCreateAsync(this IServersOperations operations, string resourceGroupName, string serverName, ServerForCreate parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateAsync(this IServersOperations operations, string resourceGroupName, string serverName, Server parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -355,7 +433,7 @@ public static Server BeginCreate(this IServersOperations operations, string reso /// /// The required parameters for updating a server. /// - public static Server BeginUpdate(this IServersOperations operations, string resourceGroupName, string serverName, ServerUpdateParameters parameters) + public static Server BeginUpdate(this IServersOperations operations, string resourceGroupName, string serverName, ServerForUpdate parameters) { return operations.BeginUpdateAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); } @@ -379,7 +457,7 @@ public static Server BeginUpdate(this IServersOperations operations, string reso /// /// The cancellation token. /// - public static async Task BeginUpdateAsync(this IServersOperations operations, string resourceGroupName, string serverName, ServerUpdateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginUpdateAsync(this IServersOperations operations, string resourceGroupName, string serverName, ServerForUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -436,9 +514,12 @@ public static void BeginDelete(this IServersOperations operations, string resour /// /// The name of the server. /// - public static void BeginRestart(this IServersOperations operations, string resourceGroupName, string serverName) + /// + /// The parameters for restarting a server. + /// + public static void BeginRestart(this IServersOperations operations, string resourceGroupName, string serverName, RestartParameter parameters = default(RestartParameter)) { - operations.BeginRestartAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + operations.BeginRestartAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); } /// @@ -453,12 +534,157 @@ public static void BeginRestart(this IServersOperations operations, string resou /// /// The name of the server. /// + /// + /// The parameters for restarting a server. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRestartAsync(this IServersOperations operations, string resourceGroupName, string serverName, RestartParameter parameters = default(RestartParameter), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRestartWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + public static void BeginStart(this IServersOperations operations, string resourceGroupName, string serverName) + { + operations.BeginStartAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// Starts a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartAsync(this IServersOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Stops a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + public static void BeginStop(this IServersOperations operations, string resourceGroupName, string serverName) + { + operations.BeginStopAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// Stops a server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStopAsync(this IServersOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStopWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List all the servers in a given resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IServersOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List all the servers in a given resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IServersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List all the servers in a given subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IServersOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List all the servers in a given subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// /// /// The cancellation token. /// - public static async Task BeginRestartAsync(this IServersOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListNextAsync(this IServersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginRestartWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/VirtualNetworkRulesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/VirtualNetworkRulesOperations.cs deleted file mode 100644 index b33e43891522..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/VirtualNetworkRulesOperations.cs +++ /dev/null @@ -1,1186 +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.PostgreSQL -{ - 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; - - /// - /// VirtualNetworkRulesOperations operations. - /// - internal partial class VirtualNetworkRulesOperations : IServiceOperations, IVirtualNetworkRulesOperations - { - /// - /// Initializes a new instance of the VirtualNetworkRulesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the PostgreSQLManagementClient - /// - public PostgreSQLManagementClient Client { get; private set; } - - /// - /// Gets a virtual network rule. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string virtualNetworkRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - if (virtualNetworkRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "virtualNetworkRuleName"); - } - string apiVersion = "2017-12-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("virtualNetworkRuleName", virtualNetworkRuleName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{virtualNetworkRuleName}", System.Uri.EscapeDataString(virtualNetworkRuleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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; - } - - /// - /// Creates or updates an existing virtual network rule. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - /// - /// The requested virtual Network Rule Resource state. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string virtualNetworkRuleName, VirtualNetworkRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes the virtual network rule with the given name. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string virtualNetworkRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, virtualNetworkRuleName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a list of virtual network rules in a server. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// 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>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - string apiVersion = "2017-12-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServer", 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.DBForPostgreSQL/servers/{serverName}/virtualNetworkRules").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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; - } - - /// - /// Creates or updates an existing virtual network rule. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - /// - /// The requested virtual Network Rule Resource state. - /// - /// - /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string virtualNetworkRuleName, VirtualNetworkRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - if (virtualNetworkRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "virtualNetworkRuleName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - string apiVersion = "2017-12-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("virtualNetworkRuleName", virtualNetworkRuleName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", 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.DBForPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{virtualNetworkRuleName}", System.Uri.EscapeDataString(virtualNetworkRuleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(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 != 201 && (int)_statusCode != 202) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _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 the virtual network rule with the given name. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - /// - /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string virtualNetworkRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (serverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); - } - if (virtualNetworkRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "virtualNetworkRuleName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - string apiVersion = "2017-12-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); - tracingParameters.Add("virtualNetworkRuleName", virtualNetworkRuleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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.DBForPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); - _url = _url.Replace("{virtualNetworkRuleName}", System.Uri.EscapeDataString(virtualNetworkRuleName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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; - } - - /// - /// Gets a list of virtual network rules in a server. - /// - /// - /// 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>> ListByServerNextWithHttpMessagesAsync(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, "ListByServerNext", 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/VirtualNetworkRulesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/VirtualNetworkRulesOperationsExtensions.cs deleted file mode 100644 index 7187020c0145..000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/VirtualNetworkRulesOperationsExtensions.cs +++ /dev/null @@ -1,335 +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.PostgreSQL -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for VirtualNetworkRulesOperations. - /// - public static partial class VirtualNetworkRulesOperationsExtensions - { - /// - /// Gets a virtual network rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - public static VirtualNetworkRule Get(this IVirtualNetworkRulesOperations operations, string resourceGroupName, string serverName, string virtualNetworkRuleName) - { - return operations.GetAsync(resourceGroupName, serverName, virtualNetworkRuleName).GetAwaiter().GetResult(); - } - - /// - /// Gets a virtual network rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IVirtualNetworkRulesOperations operations, string resourceGroupName, string serverName, string virtualNetworkRuleName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, virtualNetworkRuleName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates or updates an existing virtual network rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - /// - /// The requested virtual Network Rule Resource state. - /// - public static VirtualNetworkRule CreateOrUpdate(this IVirtualNetworkRulesOperations operations, string resourceGroupName, string serverName, string virtualNetworkRuleName, VirtualNetworkRule parameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates an existing virtual network rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - /// - /// The requested virtual Network Rule Resource state. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IVirtualNetworkRulesOperations operations, string resourceGroupName, string serverName, string virtualNetworkRuleName, VirtualNetworkRule parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes the virtual network rule with the given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - public static void Delete(this IVirtualNetworkRulesOperations operations, string resourceGroupName, string serverName, string virtualNetworkRuleName) - { - operations.DeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName).GetAwaiter().GetResult(); - } - - /// - /// Deletes the virtual network rule with the given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IVirtualNetworkRulesOperations operations, string resourceGroupName, string serverName, string virtualNetworkRuleName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, virtualNetworkRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets a list of virtual network rules in a server. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - public static IPage ListByServer(this IVirtualNetworkRulesOperations operations, string resourceGroupName, string serverName) - { - return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of virtual network rules in a server. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByServerAsync(this IVirtualNetworkRulesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates or updates an existing virtual network rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - /// - /// The requested virtual Network Rule Resource state. - /// - public static VirtualNetworkRule BeginCreateOrUpdate(this IVirtualNetworkRulesOperations operations, string resourceGroupName, string serverName, string virtualNetworkRuleName, VirtualNetworkRule parameters) - { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates an existing virtual network rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - /// - /// The requested virtual Network Rule Resource state. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IVirtualNetworkRulesOperations operations, string resourceGroupName, string serverName, string virtualNetworkRuleName, VirtualNetworkRule parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes the virtual network rule with the given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - public static void BeginDelete(this IVirtualNetworkRulesOperations operations, string resourceGroupName, string serverName, string virtualNetworkRuleName) - { - operations.BeginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName).GetAwaiter().GetResult(); - } - - /// - /// Deletes the virtual network rule with the given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the server. - /// - /// - /// The name of the virtual network rule. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IVirtualNetworkRulesOperations operations, string resourceGroupName, string serverName, string virtualNetworkRuleName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, virtualNetworkRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets a list of virtual network rules in a server. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByServerNext(this IVirtualNetworkRulesOperations operations, string nextPageLink) - { - return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of virtual network rules in a server. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByServerNextAsync(this IVirtualNetworkRulesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LogFilesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/VirtualNetworkSubnetUsageOperations.cs similarity index 78% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LogFilesOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/VirtualNetworkSubnetUsageOperations.cs index ba9fb0c480cd..596995284df4 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LogFilesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/VirtualNetworkSubnetUsageOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.PostgreSQL using System.Threading.Tasks; /// - /// LogFilesOperations operations. + /// VirtualNetworkSubnetUsageOperations operations. /// - internal partial class LogFilesOperations : IServiceOperations, ILogFilesOperations + internal partial class VirtualNetworkSubnetUsageOperations : IServiceOperations, IVirtualNetworkSubnetUsageOperations { /// - /// Initializes a new instance of the LogFilesOperations class. + /// Initializes a new instance of the VirtualNetworkSubnetUsageOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class LogFilesOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal LogFilesOperations(PostgreSQLManagementClient client) + internal VirtualNetworkSubnetUsageOperations(PostgreSQLManagementClient client) { if (client == null) { @@ -51,13 +51,13 @@ internal LogFilesOperations(PostgreSQLManagementClient client) public PostgreSQLManagementClient Client { get; private set; } /// - /// List all the log files in a given server. + /// Get virtual network subnet usage for a given vNet resource id. /// - /// - /// The name of the resource group. The name is case insensitive. + /// + /// The name of the location. /// - /// - /// The name of the server. + /// + /// The required parameters for creating or updating a server. /// /// /// Headers that will be added to request. @@ -80,8 +80,19 @@ internal LogFilesOperations(PostgreSQLManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ExecuteWithHttpMessagesAsync(string locationName, VirtualNetworkSubnetUsageParameter parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -93,30 +104,14 @@ internal LogFilesOperations(PostgreSQLManagementClient client) throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); } } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) + if (locationName == null) { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); } - if (serverName == null) + if (parameters == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -124,22 +119,20 @@ internal LogFilesOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serverName", serverName); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Execute", 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.DBForPostgreSQL/servers/{serverName}/logFiles").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DBForPostgreSql/locations/{locationName}/checkVirtualNetworkSubnetUsage").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -148,7 +141,7 @@ internal LogFilesOperations(PostgreSQLManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -179,6 +172,12 @@ internal LogFilesOperations(PostgreSQLManagementClient client) // 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) { @@ -234,7 +233,7 @@ internal LogFilesOperations(PostgreSQLManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -247,7 +246,7 @@ internal LogFilesOperations(PostgreSQLManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LocationBasedPerformanceTierOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/VirtualNetworkSubnetUsageOperationsExtensions.cs similarity index 52% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LocationBasedPerformanceTierOperationsExtensions.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/VirtualNetworkSubnetUsageOperationsExtensions.cs index 21d087090813..c83b827bb92e 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LocationBasedPerformanceTierOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/VirtualNetworkSubnetUsageOperationsExtensions.cs @@ -13,19 +13,16 @@ namespace Microsoft.Azure.Management.PostgreSQL using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; /// - /// Extension methods for LocationBasedPerformanceTierOperations. + /// Extension methods for VirtualNetworkSubnetUsageOperations. /// - public static partial class LocationBasedPerformanceTierOperationsExtensions + public static partial class VirtualNetworkSubnetUsageOperationsExtensions { /// - /// List all the performance tiers at specified location in a given - /// subscription. + /// Get virtual network subnet usage for a given vNet resource id. /// /// /// The operations group for this extension method. @@ -33,14 +30,16 @@ public static partial class LocationBasedPerformanceTierOperationsExtensions /// /// The name of the location. /// - public static IEnumerable List(this ILocationBasedPerformanceTierOperations operations, string locationName) + /// + /// The required parameters for creating or updating a server. + /// + public static VirtualNetworkSubnetUsageResult Execute(this IVirtualNetworkSubnetUsageOperations operations, string locationName, VirtualNetworkSubnetUsageParameter parameters) { - return operations.ListAsync(locationName).GetAwaiter().GetResult(); + return operations.ExecuteAsync(locationName, parameters).GetAwaiter().GetResult(); } /// - /// List all the performance tiers at specified location in a given - /// subscription. + /// Get virtual network subnet usage for a given vNet resource id. /// /// /// The operations group for this extension method. @@ -48,12 +47,15 @@ public static IEnumerable List(this ILocationBasedPer /// /// The name of the location. /// + /// + /// The required parameters for creating or updating a server. + /// /// /// The cancellation token. /// - public static async Task> ListAsync(this ILocationBasedPerformanceTierOperations operations, string locationName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ExecuteAsync(this IVirtualNetworkSubnetUsageOperations operations, string locationName, VirtualNetworkSubnetUsageParameter parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(locationName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ExecuteWithHttpMessagesAsync(locationName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; }