diff --git a/eng/mgmt/mgmtmetadata/postgresql_resource-manager.txt b/eng/mgmt/mgmtmetadata/postgresql_resource-manager.txt new file mode 100644 index 0000000000000..a51d959b948f8 --- /dev/null +++ b/eng/mgmt/mgmtmetadata/postgresql_resource-manager.txt @@ -0,0 +1,14 @@ +Installing AutoRest version: v2 +AutoRest installed successfully. +Commencing code generation +Generating CSharp code +Executing AutoRest command +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.namespace=Microsoft.Azure.Management.PostgreSQL.FlexibleServers --tag=package-2020-02-14-privatepreview --csharp.output-folder=C:\z\azure-sdk-for-net\sdk\postgresql\Microsoft.Azure.Management.PostgreSQL\src\postgresqlflexibleservers\Generated +2020-09-11 22:12:52 UTC +Azure-rest-api-specs repository information +GitHub fork: Azure +Branch: master +Commit: faf8e1c19e3b36e6d16622bf168369a838b04a7f +AutoRest information +Requested version: v2 +Bootstrapper version: autorest@2.0.4413 diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/AzSdk.RP.props b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/AzSdk.RP.props index 3f57db183b4f7..65a711a104300 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/AzSdk.RP.props +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/AzSdk.RP.props @@ -1,7 +1,7 @@  - DBforPostgreSQL_2017-12-01; + DBforPostgreSQL_2017-12-01;DBforPostgreSQL_2018-06-01;DBforPostgreSQL_2020-01-01;DBforPostgreSQL_2020-02-14-privatepreview; $(PackageTags);$(CommonTags);$(AzureApiTag); \ No newline at end of file diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/SdkInfo_PostgreSQLManagementClient.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/SdkInfo_PostgreSQLManagementClient.cs deleted file mode 100644 index de96637c193f0..0000000000000 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/SdkInfo_PostgreSQLManagementClient.cs +++ /dev/null @@ -1,37 +0,0 @@ - -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.PostgreSQL -{ - using System; - using System.Collections.Generic; - using System.Linq; - - internal static partial class SdkInfo - { - public static IEnumerable> ApiInfo_PostgreSQLManagementClient - { - get - { - 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", "ServerSecurityAlertPolicies", "2017-12-01"), - new Tuple("DBforPostgreSQL", "Servers", "2017-12-01"), - new Tuple("DBforPostgreSQL", "VirtualNetworkRules", "2017-12-01"), - }.AsEnumerable(); - } - } - } -} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Microsoft.Azure.Management.PostgreSQL.csproj b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Microsoft.Azure.Management.PostgreSQL.csproj index 1a9c3553c79dd..7027224f3f202 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Microsoft.Azure.Management.PostgreSQL.csproj +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Microsoft.Azure.Management.PostgreSQL.csproj @@ -6,13 +6,14 @@ Microsoft.Azure.Management.PostgreSQL Provides developers with libraries for the Azure Database for PostgreSQL under Azure Resource manager to deploy an instance of PostgreSQL. Create, Update, Delete, Restore, and more. - 0.9.0-preview + 0.9.5-preview Microsoft.Azure.Management.PostgreSQL PostgreSQL;Azure Database for PostgreSQL; + This is a public release of the Azure Database for PostgreSQL SDK. This release includes management libraries for managing + New deployment type called Flexible-Servers (refer aka.ms/postgresflexibleserver for more info) + ]]> diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Properties/AssemblyInfo.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Properties/AssemblyInfo.cs index 2ec69f30faac0..5eb22e554d330 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Properties/AssemblyInfo.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ [assembly: AssemblyTitle("Microsoft Azure Database for PostgreSQL Management Library")] [assembly: AssemblyDescription("Provides management functionality for Microsoft Azure Database for PostgreSQL Resources.")] -[assembly: AssemblyVersion("0.9.0")] -[assembly: AssemblyFileVersion("0.9.0")] +[assembly: AssemblyVersion("0.9.5")] +[assembly: AssemblyFileVersion("0.9.5")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Microsoft Azure .NET SDK")] diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/generate.ps1 b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/generate.ps1 index a07665f48e0fe..1133b214c10d6 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/generate.ps1 +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/generate.ps1 @@ -1 +1,2 @@ -Start-AutoRestCodeGeneration -ResourceProvider "postgresql/resource-manager" -AutoRestVersion "v2" +Start-AutoRestCodeGeneration -ResourceProvider "postgresql/resource-manager" -AutoRestVersion "v2" -SdkGenerationDirectory "$PSScriptRoot\postgresql\Generated" +Start-AutoRestCodeGeneration -ResourceProvider "postgresql/resource-manager" -AutoRestVersion "v2" -SdkGenerationDirectory "$PSScriptRoot\postgresqlflexibleservers\Generated" -ConfigFileTag "package-2020-02-14-privatepreview" -Namespace "Microsoft.Azure.Management.PostgreSQL.FlexibleServers" diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/CheckNameAvailabilityOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/CheckNameAvailabilityOperations.cs similarity index 95% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/CheckNameAvailabilityOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/CheckNameAvailabilityOperations.cs index 05f96f4f27b53..28c3e6068754a 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/CheckNameAvailabilityOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/CheckNameAvailabilityOperations.cs @@ -79,14 +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.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 (nameAvailabilityRequest == null) { throw new ValidationException(ValidationRules.CannotBeNull, "nameAvailabilityRequest"); @@ -95,6 +98,7 @@ internal CheckNameAvailabilityOperations(PostgreSQLManagementClient client) { nameAvailabilityRequest.Validate(); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -102,18 +106,19 @@ 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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/CheckNameAvailabilityOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/CheckNameAvailabilityOperationsExtensions.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/CheckNameAvailabilityOperationsExtensions.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/CheckNameAvailabilityOperationsExtensions.cs diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ConfigurationsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ConfigurationsOperations.cs similarity index 88% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ConfigurationsOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ConfigurationsOperations.cs index a28796d077951..68cafb36067b4 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ConfigurationsOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ConfigurationsOperations.cs @@ -54,8 +54,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) /// Updates a configuration of a server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -83,8 +82,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) /// Gets information about a configuration of server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -115,18 +113,36 @@ 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.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"); @@ -135,6 +151,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "configurationName"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -142,6 +159,7 @@ 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); @@ -150,15 +168,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/servers/{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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -289,8 +307,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) /// List all the configurations in a given server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -318,22 +335,41 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) /// 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.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; @@ -341,6 +377,7 @@ 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("cancellationToken", cancellationToken); @@ -348,14 +385,14 @@ 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").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{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) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -486,8 +523,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) /// Updates a configuration of a server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -521,18 +557,36 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) /// public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(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.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"); @@ -545,6 +599,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -552,6 +607,7 @@ 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); @@ -561,15 +617,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/servers/{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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ConfigurationsOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ConfigurationsOperationsExtensions.cs similarity index 87% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ConfigurationsOperationsExtensions.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ConfigurationsOperationsExtensions.cs index 2867544747893..baa28212f6495 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ConfigurationsOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ConfigurationsOperationsExtensions.cs @@ -30,8 +30,7 @@ public static partial class ConfigurationsOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -54,8 +53,7 @@ public static Configuration CreateOrUpdate(this IConfigurationsOperations operat /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -84,8 +82,7 @@ public static Configuration CreateOrUpdate(this IConfigurationsOperations operat /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -105,8 +102,7 @@ public static Configuration Get(this IConfigurationsOperations operations, strin /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -132,8 +128,7 @@ public static Configuration Get(this IConfigurationsOperations operations, strin /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -150,8 +145,7 @@ public static IEnumerable ListByServer(this IConfigurationsOperat /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -174,8 +168,7 @@ public static IEnumerable ListByServer(this IConfigurationsOperat /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -198,8 +191,7 @@ public static Configuration BeginCreateOrUpdate(this IConfigurationsOperations o /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/DatabasesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/DatabasesOperations.cs similarity index 88% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/DatabasesOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/DatabasesOperations.cs index be297d9d571a1..288e2cf275ea9 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/DatabasesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/DatabasesOperations.cs @@ -54,8 +54,7 @@ internal DatabasesOperations(PostgreSQLManagementClient client) /// Creates a new database or updates an existing database. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -83,8 +82,7 @@ internal DatabasesOperations(PostgreSQLManagementClient client) /// Deletes a database. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -109,8 +107,7 @@ internal DatabasesOperations(PostgreSQLManagementClient client) /// Gets information about a database. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -141,18 +138,36 @@ 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.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"); @@ -161,6 +176,7 @@ internal DatabasesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -168,6 +184,7 @@ 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); @@ -176,15 +193,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/servers/{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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -315,8 +332,7 @@ internal DatabasesOperations(PostgreSQLManagementClient client) /// List all the databases in a given server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -344,22 +360,41 @@ internal DatabasesOperations(PostgreSQLManagementClient client) /// 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.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; @@ -367,6 +402,7 @@ 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); @@ -374,14 +410,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/servers/{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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -512,8 +548,7 @@ internal DatabasesOperations(PostgreSQLManagementClient client) /// Creates a new database or updates an existing database. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -547,18 +582,36 @@ internal DatabasesOperations(PostgreSQLManagementClient client) /// public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(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.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"); @@ -571,6 +624,7 @@ internal DatabasesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -578,6 +632,7 @@ 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); @@ -587,15 +642,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/servers/{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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -750,8 +805,7 @@ internal DatabasesOperations(PostgreSQLManagementClient client) /// Deletes a database. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -779,18 +833,36 @@ 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.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"); @@ -799,6 +871,7 @@ internal DatabasesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -806,6 +879,7 @@ 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); @@ -814,15 +888,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/servers/{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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/DatabasesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/DatabasesOperationsExtensions.cs similarity index 86% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/DatabasesOperationsExtensions.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/DatabasesOperationsExtensions.cs index eb413e9f87d67..f3a1a5e17b8b2 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/DatabasesOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/DatabasesOperationsExtensions.cs @@ -30,8 +30,7 @@ public static partial class DatabasesOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -54,8 +53,7 @@ public static Database CreateOrUpdate(this IDatabasesOperations operations, stri /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -84,8 +82,7 @@ public static Database CreateOrUpdate(this IDatabasesOperations operations, stri /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -105,8 +102,7 @@ public static void Delete(this IDatabasesOperations operations, string resourceG /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -129,8 +125,7 @@ public static void Delete(this IDatabasesOperations operations, string resourceG /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -150,8 +145,7 @@ public static Database Get(this IDatabasesOperations operations, string resource /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -177,8 +171,7 @@ public static Database Get(this IDatabasesOperations operations, string resource /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -195,8 +188,7 @@ public static IEnumerable ListByServer(this IDatabasesOperations opera /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -219,8 +211,7 @@ public static IEnumerable ListByServer(this IDatabasesOperations opera /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -243,8 +234,7 @@ public static Database BeginCreateOrUpdate(this IDatabasesOperations operations, /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -273,8 +263,7 @@ public static Database BeginCreateOrUpdate(this IDatabasesOperations operations, /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -294,8 +283,7 @@ public static void BeginDelete(this IDatabasesOperations operations, string reso /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/FirewallRulesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/FirewallRulesOperations.cs similarity index 88% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/FirewallRulesOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/FirewallRulesOperations.cs index 3c2b301597c9f..a3dc237bccb0a 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/FirewallRulesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/FirewallRulesOperations.cs @@ -54,8 +54,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) /// Creates a new firewall rule or updates an existing firewall rule. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -83,8 +82,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) /// Deletes a server firewall rule. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -109,8 +107,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) /// Gets information about a server firewall rule. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -141,18 +138,36 @@ 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.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"); @@ -161,6 +176,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -168,6 +184,7 @@ 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); @@ -176,15 +193,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/servers/{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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -315,8 +332,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) /// List all the firewall rules in a given server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -344,22 +360,41 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) /// 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.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; @@ -367,6 +402,7 @@ 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); @@ -374,14 +410,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/servers/{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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -512,8 +548,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) /// Creates a new firewall rule or updates an existing firewall rule. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -547,18 +582,36 @@ 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.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"); @@ -575,6 +628,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) { parameters.Validate(); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -582,6 +636,7 @@ 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); @@ -591,15 +646,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/servers/{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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -754,8 +809,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) /// Deletes a server firewall rule. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -783,18 +837,36 @@ 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.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"); @@ -803,6 +875,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -810,6 +883,7 @@ 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); @@ -818,15 +892,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/servers/{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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/FirewallRulesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/FirewallRulesOperationsExtensions.cs similarity index 86% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/FirewallRulesOperationsExtensions.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/FirewallRulesOperationsExtensions.cs index a510a677024f7..e8caebc5390f1 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/FirewallRulesOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/FirewallRulesOperationsExtensions.cs @@ -30,8 +30,7 @@ public static partial class FirewallRulesOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -54,8 +53,7 @@ public static FirewallRule CreateOrUpdate(this IFirewallRulesOperations operatio /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -84,8 +82,7 @@ public static FirewallRule CreateOrUpdate(this IFirewallRulesOperations operatio /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -105,8 +102,7 @@ public static void Delete(this IFirewallRulesOperations operations, string resou /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -129,8 +125,7 @@ public static void Delete(this IFirewallRulesOperations operations, string resou /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -150,8 +145,7 @@ public static FirewallRule Get(this IFirewallRulesOperations operations, string /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -177,8 +171,7 @@ public static FirewallRule Get(this IFirewallRulesOperations operations, string /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -195,8 +188,7 @@ public static IEnumerable ListByServer(this IFirewallRulesOperatio /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -219,8 +211,7 @@ public static IEnumerable ListByServer(this IFirewallRulesOperatio /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -243,8 +234,7 @@ public static FirewallRule BeginCreateOrUpdate(this IFirewallRulesOperations ope /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -273,8 +263,7 @@ public static FirewallRule BeginCreateOrUpdate(this IFirewallRulesOperations ope /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -294,8 +283,7 @@ public static void BeginDelete(this IFirewallRulesOperations operations, string /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ICheckNameAvailabilityOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ICheckNameAvailabilityOperations.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ICheckNameAvailabilityOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ICheckNameAvailabilityOperations.cs diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IConfigurationsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IConfigurationsOperations.cs similarity index 90% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IConfigurationsOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IConfigurationsOperations.cs index 7ef80e7971f9f..3aa3766785555 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IConfigurationsOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IConfigurationsOperations.cs @@ -27,9 +27,7 @@ public partial interface IConfigurationsOperations /// Updates a configuration of a server. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -60,9 +58,7 @@ public partial interface IConfigurationsOperations /// Gets information about a configuration of server. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -90,9 +86,7 @@ public partial interface IConfigurationsOperations /// List all the configurations in a given server. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -117,9 +111,7 @@ public partial interface IConfigurationsOperations /// Updates a configuration of a server. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IDatabasesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IDatabasesOperations.cs similarity index 89% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IDatabasesOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IDatabasesOperations.cs index 0d733ac50ff34..51caa9ffa029c 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IDatabasesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IDatabasesOperations.cs @@ -27,9 +27,7 @@ public partial interface IDatabasesOperations /// Creates a new database or updates an existing database. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -60,9 +58,7 @@ public partial interface IDatabasesOperations /// Deletes a database. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -87,9 +83,7 @@ public partial interface IDatabasesOperations /// Gets information about a database. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -117,9 +111,7 @@ public partial interface IDatabasesOperations /// List all the databases in a given server. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -144,9 +136,7 @@ public partial interface IDatabasesOperations /// Creates a new database or updates an existing database. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -177,9 +167,7 @@ public partial interface IDatabasesOperations /// Deletes a database. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IFirewallRulesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IFirewallRulesOperations.cs similarity index 89% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IFirewallRulesOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IFirewallRulesOperations.cs index 7101fab1cf807..b7d0052b84ba0 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IFirewallRulesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IFirewallRulesOperations.cs @@ -27,9 +27,7 @@ public partial interface IFirewallRulesOperations /// Creates a new firewall rule or updates an existing firewall rule. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -60,9 +58,7 @@ public partial interface IFirewallRulesOperations /// Deletes a server firewall rule. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -87,9 +83,7 @@ public partial interface IFirewallRulesOperations /// Gets information about a server firewall rule. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -117,9 +111,7 @@ public partial interface IFirewallRulesOperations /// List all the firewall rules in a given server. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -144,9 +136,7 @@ public partial interface IFirewallRulesOperations /// Creates a new firewall rule or updates an existing firewall rule. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -177,9 +167,7 @@ public partial interface IFirewallRulesOperations /// Deletes a server firewall rule. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ILocationBasedPerformanceTierOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ILocationBasedPerformanceTierOperations.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ILocationBasedPerformanceTierOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ILocationBasedPerformanceTierOperations.cs diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ILogFilesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ILogFilesOperations.cs similarity index 91% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ILogFilesOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ILogFilesOperations.cs index 2c84402fe14e7..86dce1f84e0d9 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ILogFilesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ILogFilesOperations.cs @@ -27,9 +27,7 @@ public partial interface ILogFilesOperations /// List all the log files in a given server. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IOperations.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IOperations.cs diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IPostgreSQLManagementClient.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IPostgreSQLManagementClient.cs similarity index 85% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IPostgreSQLManagementClient.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IPostgreSQLManagementClient.cs index 5b49358512be0..6735268b4da60 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IPostgreSQLManagementClient.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IPostgreSQLManagementClient.cs @@ -44,15 +44,10 @@ public partial interface IPostgreSQLManagementClient : System.IDisposable ServiceClientCredentials Credentials { get; } /// - /// The subscription ID that identifies an Azure subscription. + /// The ID of the target subscription. /// string SubscriptionId { get; set; } - /// - /// The API version to use for the request. - /// - string ApiVersion { get; } - /// /// The preferred language for the response. /// @@ -107,6 +102,11 @@ public partial interface IPostgreSQLManagementClient : System.IDisposable /// ILogFilesOperations LogFiles { get; } + /// + /// Gets the IServerAdministratorsOperations. + /// + IServerAdministratorsOperations ServerAdministrators { get; } + /// /// Gets the ILocationBasedPerformanceTierOperations. /// @@ -117,15 +117,30 @@ public partial interface IPostgreSQLManagementClient : System.IDisposable /// ICheckNameAvailabilityOperations CheckNameAvailability { get; } + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + /// /// Gets the IServerSecurityAlertPoliciesOperations. /// IServerSecurityAlertPoliciesOperations ServerSecurityAlertPolicies { get; } /// - /// Gets the IOperations. + /// Gets the IPrivateEndpointConnectionsOperations. /// - IOperations Operations { get; } + IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } + + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + IPrivateLinkResourcesOperations PrivateLinkResources { get; } + + /// + /// Gets the IServerKeysOperations. + /// + IServerKeysOperations ServerKeys { 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 new file mode 100644 index 0000000000000..f08e2ede0a8e2 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IPrivateEndpointConnectionsOperations.cs @@ -0,0 +1,276 @@ +// +// 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 new file mode 100644 index 0000000000000..1f1943b06c37d --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IPrivateLinkResourcesOperations.cs @@ -0,0 +1,102 @@ +// +// 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/Generated/IReplicasOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IReplicasOperations.cs similarity index 91% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IReplicasOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IReplicasOperations.cs index ab17e45748a35..9a64ff3150b60 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IReplicasOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IReplicasOperations.cs @@ -27,9 +27,7 @@ public partial interface IReplicasOperations /// List all the replicas for a given server. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. 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 new file mode 100644 index 0000000000000..1e3c61b5a9dbd --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerAdministratorsOperations.cs @@ -0,0 +1,183 @@ +// +// 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 new file mode 100644 index 0000000000000..d7eb0a9635f4f --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerKeysOperations.cs @@ -0,0 +1,216 @@ +// +// 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/Generated/IServerSecurityAlertPoliciesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerSecurityAlertPoliciesOperations.cs similarity index 90% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IServerSecurityAlertPoliciesOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerSecurityAlertPoliciesOperations.cs index fcb33f3308c61..cdfb5c56c6a9d 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IServerSecurityAlertPoliciesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerSecurityAlertPoliciesOperations.cs @@ -27,9 +27,7 @@ public partial interface IServerSecurityAlertPoliciesOperations /// Get a server's security alert policy. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -54,9 +52,7 @@ public partial interface IServerSecurityAlertPoliciesOperations /// Creates or updates a threat detection policy. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -84,9 +80,7 @@ public partial interface IServerSecurityAlertPoliciesOperations /// Creates or updates a threat detection policy. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IServersOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServersOperations.cs similarity index 88% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IServersOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServersOperations.cs index 7d3c9ace6d574..8d164f836cfc8 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IServersOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServersOperations.cs @@ -27,9 +27,7 @@ public partial interface IServersOperations /// Creates a new server, or will overwrite an existing server. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -58,9 +56,7 @@ public partial interface IServersOperations /// many of the properties present in the normal server definition. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -88,9 +84,7 @@ public partial interface IServersOperations /// Deletes a server. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -112,9 +106,7 @@ public partial interface IServersOperations /// Gets information about a server. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -139,9 +131,7 @@ public partial interface IServersOperations /// List all the servers in a given resource group. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The headers that will be added to request. @@ -182,9 +172,7 @@ public partial interface IServersOperations /// Restarts a server. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -206,9 +194,7 @@ public partial interface IServersOperations /// Creates a new server, or will overwrite an existing server. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -237,9 +223,7 @@ public partial interface IServersOperations /// many of the properties present in the normal server definition. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -267,9 +251,7 @@ public partial interface IServersOperations /// Deletes a server. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -291,9 +273,7 @@ public partial interface IServersOperations /// Restarts a server. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IVirtualNetworkRulesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IVirtualNetworkRulesOperations.cs similarity index 90% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IVirtualNetworkRulesOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IVirtualNetworkRulesOperations.cs index de6ab786ebbf9..379c985193de5 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IVirtualNetworkRulesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IVirtualNetworkRulesOperations.cs @@ -27,9 +27,7 @@ public partial interface IVirtualNetworkRulesOperations /// Gets a virtual network rule. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -57,9 +55,7 @@ public partial interface IVirtualNetworkRulesOperations /// Creates or updates an existing virtual network rule. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -90,9 +86,7 @@ public partial interface IVirtualNetworkRulesOperations /// Deletes the virtual network rule with the given name. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -117,9 +111,7 @@ public partial interface IVirtualNetworkRulesOperations /// Gets a list of virtual network rules in a server. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -144,9 +136,7 @@ public partial interface IVirtualNetworkRulesOperations /// Creates or updates an existing virtual network rule. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -177,9 +167,7 @@ public partial interface IVirtualNetworkRulesOperations /// Deletes the virtual network rule with the given name. /// /// - /// The name of the resource group that contains the resource. You can - /// obtain this value from the Azure Resource Manager API or the - /// portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LocationBasedPerformanceTierOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LocationBasedPerformanceTierOperations.cs similarity index 95% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LocationBasedPerformanceTierOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LocationBasedPerformanceTierOperations.cs index 1e532b64a474a..5c0729a036d4a 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LocationBasedPerformanceTierOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LocationBasedPerformanceTierOperations.cs @@ -80,18 +80,22 @@ internal LocationBasedPerformanceTierOperations(PostgreSQLManagementClient clien /// public async Task>> ListWithHttpMessagesAsync(string locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } 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 (locationName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -99,19 +103,20 @@ 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); } // 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(); + 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)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LocationBasedPerformanceTierOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LocationBasedPerformanceTierOperationsExtensions.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LocationBasedPerformanceTierOperationsExtensions.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LocationBasedPerformanceTierOperationsExtensions.cs diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LogFilesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LogFilesOperations.cs similarity index 89% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LogFilesOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LogFilesOperations.cs index 2c03293c34e7f..ba9fb0c480cd1 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LogFilesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LogFilesOperations.cs @@ -54,8 +54,7 @@ internal LogFilesOperations(PostgreSQLManagementClient client) /// List all the log files in a given server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -83,22 +82,41 @@ internal LogFilesOperations(PostgreSQLManagementClient client) /// 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.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; @@ -106,6 +124,7 @@ 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("cancellationToken", cancellationToken); @@ -113,14 +132,14 @@ internal LogFilesOperations(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}/logFiles").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/logFiles").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) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LogFilesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LogFilesOperationsExtensions.cs similarity index 88% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LogFilesOperationsExtensions.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LogFilesOperationsExtensions.cs index 17f489ccaec0b..53640a18d0b3c 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LogFilesOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/LogFilesOperationsExtensions.cs @@ -30,8 +30,7 @@ public static partial class LogFilesOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -48,8 +47,7 @@ public static IEnumerable ListByServer(this ILogFilesOperations operati /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. 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 new file mode 100644 index 0000000000000..f2a5a62dd650d --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/AzureEntityResource.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; + + /// + /// The resource model definition for a Azure Resource Manager resource + /// with an etag. + /// + public partial class AzureEntityResource : Resource + { + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + public AzureEntityResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureEntityResource 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. + /// Resource Etag. + public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + : base(id, name, type) + { + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Etag. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Configuration.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Configuration.cs similarity index 88% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Configuration.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Configuration.cs index 8f040f9393cf8..e41b79330b4b9 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Configuration.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Configuration.cs @@ -32,9 +32,12 @@ public Configuration() /// /// Initializes a new instance of the Configuration class. /// - /// Resource ID - /// Resource name. - /// Resource type. + /// 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. /// Value of the configuration. /// Description of the configuration. /// Default value of the diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Database.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Database.cs similarity index 81% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Database.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Database.cs index a62cddc775c70..b27e69c298d5a 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Database.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Database.cs @@ -32,9 +32,12 @@ public Database() /// /// Initializes a new instance of the Database class. /// - /// Resource ID - /// Resource name. - /// Resource type. + /// 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 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)) diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ErrorAdditionalInfo.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 0000000000000..e14d43ba90608 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ErrorAdditionalInfo.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; + + /// + /// The resource management error additional info. + /// + public partial class ErrorAdditionalInfo + { + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + public ErrorAdditionalInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + /// The additional info type. + /// The additional info. + public ErrorAdditionalInfo(string type = default(string), object info = default(object)) + { + Type = type; + Info = info; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the additional info type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the additional info. + /// + [JsonProperty(PropertyName = "info")] + public object Info { 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 new file mode 100644 index 0000000000000..83a64fe687016 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ErrorResponse.cs @@ -0,0 +1,85 @@ +// +// 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; + + /// + /// The resource management error response. + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The error code. + /// The error message. + /// The error target. + /// The error details. + /// The error additional info. + public ErrorResponse(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + AdditionalInfo = additionalInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the error target. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/FirewallRule.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/FirewallRule.cs similarity index 89% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/FirewallRule.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/FirewallRule.cs index 607d1e43dd9d4..5603a81676a6c 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/FirewallRule.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/FirewallRule.cs @@ -36,9 +36,12 @@ public FirewallRule() /// firewall rule. Must be IPv4 format. /// The end IP address of the server /// firewall rule. Must be IPv4 format. - /// Resource ID - /// Resource name. - /// Resource type. + /// 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)) : base(id, name, type) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/GeoRedundantBackup.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/GeoRedundantBackup.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/GeoRedundantBackup.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/GeoRedundantBackup.cs 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/IdentityType.cs new file mode 100644 index 0000000000000..7825c32e71e4a --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/IdentityType.cs @@ -0,0 +1,21 @@ +// +// 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 IdentityType. + /// + public static class IdentityType + { + public const string SystemAssigned = "SystemAssigned"; + } +} 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/InfrastructureEncryption.cs new file mode 100644 index 0000000000000..90aed8cf0982d --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/InfrastructureEncryption.cs @@ -0,0 +1,28 @@ +// +// 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 InfrastructureEncryption. + /// + public static class InfrastructureEncryption + { + /// + /// 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"; + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/LogFile.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/LogFile.cs similarity index 87% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/LogFile.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/LogFile.cs index a536fd9f5e8bd..f2d928126710c 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/LogFile.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/LogFile.cs @@ -32,9 +32,12 @@ public LogFile() /// /// Initializes a new instance of the LogFile class. /// - /// Resource ID - /// Resource name. - /// Resource type. + /// 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. 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 new file mode 100644 index 0000000000000..2652830dff36b --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/MinimalTlsVersionEnum.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 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/Generated/Models/NameAvailability.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/NameAvailability.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/NameAvailability.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/NameAvailability.cs diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/NameAvailabilityRequest.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/NameAvailabilityRequest.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/NameAvailabilityRequest.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/NameAvailabilityRequest.cs diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Operation.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Operation.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Operation.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Operation.cs diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/OperationDisplay.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/OperationDisplay.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/OperationDisplay.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/OperationDisplay.cs diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/OperationListResult.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/OperationListResult.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/OperationListResult.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/OperationListResult.cs diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/OperationOrigin.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/OperationOrigin.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/OperationOrigin.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/OperationOrigin.cs diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Page.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Page.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Page.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Page.cs diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Page1.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Page1.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Page1.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Page1.cs diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PerformanceTierProperties.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PerformanceTierProperties.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PerformanceTierProperties.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PerformanceTierProperties.cs diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PerformanceTierServiceLevelObjectives.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PerformanceTierServiceLevelObjectives.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PerformanceTierServiceLevelObjectives.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PerformanceTierServiceLevelObjectives.cs 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 new file mode 100644 index 0000000000000..d0f5e74f37c6b --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateEndpointConnection.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.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/PrivateEndpointProperty.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateEndpointProperty.cs new file mode 100644 index 0000000000000..505e7303626ef --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateEndpointProperty.cs @@ -0,0 +1,50 @@ +// +// 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.Linq; + + public partial class PrivateEndpointProperty : IResource + { + /// + /// Initializes a new instance of the PrivateEndpointProperty class. + /// + public PrivateEndpointProperty() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpointProperty class. + /// + /// Resource id of the private endpoint. + public PrivateEndpointProperty(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource id of the private endpoint. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} 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 new file mode 100644 index 0000000000000..f00516eae0445 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateEndpointProvisioningState.cs @@ -0,0 +1,25 @@ +// +// 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 new file mode 100644 index 0000000000000..d6071c15d6c7e --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkResource.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; + + /// + /// 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 new file mode 100644 index 0000000000000..6760ae16c1ced --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkResourceProperties.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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/PrivateLinkServiceConnectionStateActionsRequire.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkServiceConnectionStateActionsRequire.cs new file mode 100644 index 0000000000000..e1620432e5279 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkServiceConnectionStateActionsRequire.cs @@ -0,0 +1,21 @@ +// +// 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 PrivateLinkServiceConnectionStateActionsRequire. + /// + public static class PrivateLinkServiceConnectionStateActionsRequire + { + public const string None = "None"; + } +} 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 new file mode 100644 index 0000000000000..feab0c488c4c6 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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 new file mode 100644 index 0000000000000..c9992315e6d06 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkServiceConnectionStateStatus.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 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/Generated/Models/ProxyResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ProxyResource.cs similarity index 55% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ProxyResource.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ProxyResource.cs index 6b8b2bda7980e..2218086919479 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ProxyResource.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ProxyResource.cs @@ -10,15 +10,13 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models { - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Newtonsoft.Json; using System.Linq; /// - /// Resource properties. + /// The resource model definition for a ARM proxy resource. It will have + /// everything other than required location and tags /// - public partial class ProxyResource : IResource + public partial class ProxyResource : Resource { /// /// Initializes a new instance of the ProxyResource class. @@ -31,14 +29,15 @@ public ProxyResource() /// /// Initializes a new instance of the ProxyResource class. /// - /// Resource ID - /// Resource name. - /// Resource type. + /// 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 ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) { - Id = id; - Name = name; - Type = type; CustomInit(); } @@ -47,23 +46,5 @@ public ProxyResource() /// partial void CustomInit(); - /// - /// Gets resource ID - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets resource name. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets resource type. - /// - [JsonProperty(PropertyName = "type")] - public string Type { 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/PublicNetworkAccessEnum.cs new file mode 100644 index 0000000000000..304db450b0c41 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PublicNetworkAccessEnum.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.Models +{ + + /// + /// Defines values for PublicNetworkAccessEnum. + /// + public static class PublicNetworkAccessEnum + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} 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 new file mode 100644 index 0000000000000..00ee8d855eb5e --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Resource.cs @@ -0,0 +1,72 @@ +// +// 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.Linq; + + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource 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. + public Resource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + 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. Ex- + /// 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 new file mode 100644 index 0000000000000..01acfc21d8273 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ResourceIdentity.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; + + /// + /// 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/Generated/Models/Server.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Server.cs similarity index 58% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Server.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Server.cs index d957bbfe887d6..5cb4f611fe041 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Server.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Server.cs @@ -34,25 +34,37 @@ public Server() /// /// Initializes a new instance of the Server class. /// - /// The location the resource resides - /// in. - /// Resource ID - /// Resource name. - /// Resource type. - /// Application-specific metadata in the form of - /// key-value pairs. + /// The geo-location where the resource + /// lives + /// 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. + /// Resource tags. + /// The Azure Active Directory identity of the + /// server. /// The SKU (pricing tier) of the 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' + /// '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' + /// to user. Possible values include: 'Ready', 'Dropping', 'Disabled', + /// 'Inaccessible' /// The fully qualified domain /// name of a server. /// Earliest restore point creation @@ -64,13 +76,23 @@ public Server() /// server. /// The maximum number of replicas that a /// master server can have. - public Server(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), string administratorLogin = default(string), string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), 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?)) + /// 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)) : base(location, id, name, type, tags) { + Identity = identity; Sku = sku; AdministratorLogin = administratorLogin; Version = version; SslEnforcement = sslEnforcement; + MinimalTlsVersion = minimalTlsVersion; + ByokEnforcement = byokEnforcement; + InfrastructureEncryption = infrastructureEncryption; UserVisibleState = userVisibleState; FullyQualifiedDomainName = fullyQualifiedDomainName; EarliestRestoreDate = earliestRestoreDate; @@ -78,6 +100,8 @@ public Server() ReplicationRole = replicationRole; MasterServerId = masterServerId; ReplicaCapacity = replicaCapacity; + PublicNetworkAccess = publicNetworkAccess; + PrivateEndpointConnections = privateEndpointConnections; CustomInit(); } @@ -86,6 +110,12 @@ public Server() /// 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. /// @@ -102,7 +132,7 @@ public Server() /// /// Gets or sets server version. Possible values include: '9.5', '9.6', - /// '10', '10.0', '10.2' + /// '10', '10.0', '10.2', '11' /// [JsonProperty(PropertyName = "properties.version")] public string Version { get; set; } @@ -114,9 +144,32 @@ public Server() [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 status showing whether the server data encryption is enabled + /// with customer-managed keys. + /// + [JsonProperty(PropertyName = "properties.byokEnforcement")] + public string ByokEnforcement { get; private set; } + + /// + /// Gets or sets status showing whether the server enabled + /// infrastructure encryption. Possible values include: 'Enabled', + /// 'Disabled' + /// + [JsonProperty(PropertyName = "properties.infrastructureEncryption")] + public string InfrastructureEncryption { get; set; } + /// /// Gets or sets a state of a server that is visible to user. Possible - /// values include: 'Ready', 'Dropping', 'Disabled' + /// values include: 'Ready', 'Dropping', 'Disabled', 'Inaccessible' /// [JsonProperty(PropertyName = "properties.userVisibleState")] public string UserVisibleState { get; set; } @@ -158,6 +211,20 @@ public Server() [JsonProperty(PropertyName = "properties.replicaCapacity")] public int? ReplicaCapacity { 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 list of private endpoint connections on a server + /// + [JsonProperty(PropertyName = "properties.privateEndpointConnections")] + public IList PrivateEndpointConnections { get; private set; } + /// /// Validate the object. /// @@ -175,6 +242,16 @@ public override void Validate() { 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 new file mode 100644 index 0000000000000..c410cd4202dbc --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerAdministratorResource.cs @@ -0,0 +1,107 @@ +// +// 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/Generated/Models/ServerForCreate.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerForCreate.cs similarity index 85% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerForCreate.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerForCreate.cs index 9b7ee4c4a4b58..78a7a2a70fbac 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerForCreate.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerForCreate.cs @@ -35,11 +35,14 @@ public ServerForCreate() /// 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, Sku sku = default(Sku), IDictionary tags = default(IDictionary)) + 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; @@ -52,6 +55,12 @@ public ServerForCreate() /// 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. /// 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 new file mode 100644 index 0000000000000..113635eb5fd6a --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerKey.cs @@ -0,0 +1,91 @@ +// +// 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 new file mode 100644 index 0000000000000..b711754ebf94b --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPrivateEndpointConnection.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; + + /// + /// 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 new file mode 100644 index 0000000000000..915658ad2375f --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPrivateEndpointConnectionProperties.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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 new file mode 100644 index 0000000000000..fe0849058efd2 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPrivateLinkServiceConnectionStateProperty.cs @@ -0,0 +1,90 @@ +// +// 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/Generated/Models/ServerPropertiesForCreate.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForCreate.cs similarity index 52% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForCreate.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForCreate.cs index a88781652d684..2f0292d2b4630 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForCreate.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForCreate.cs @@ -30,15 +30,28 @@ public ServerPropertiesForCreate() /// Initializes a new instance of the ServerPropertiesForCreate class. /// /// Server version. Possible values include: - /// '9.5', '9.6', '10', '10.0', '10.2' + /// '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?), StorageProfile storageProfile = default(StorageProfile)) + 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(); } @@ -50,7 +63,7 @@ public ServerPropertiesForCreate() /// /// Gets or sets server version. Possible values include: '9.5', '9.6', - /// '10', '10.0', '10.2' + /// '10', '10.0', '10.2', '11' /// [JsonProperty(PropertyName = "version")] public string Version { get; set; } @@ -62,6 +75,30 @@ public ServerPropertiesForCreate() [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. /// diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForDefaultCreate.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForDefaultCreate.cs similarity index 76% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForDefaultCreate.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForDefaultCreate.cs index e53f9da95499f..788f62930bd3e 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForDefaultCreate.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForDefaultCreate.cs @@ -39,13 +39,23 @@ public ServerPropertiesForDefaultCreate() /// The password of the /// administrator login. /// Server version. Possible values include: - /// '9.5', '9.6', '10', '10.0', '10.2' + /// '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?), StorageProfile storageProfile = default(StorageProfile)) - : base(version, sslEnforcement, storageProfile) + 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; diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForGeoRestore.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForGeoRestore.cs similarity index 70% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForGeoRestore.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForGeoRestore.cs index 95e48dfb3a82c..8e52f7d9b1239 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForGeoRestore.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForGeoRestore.cs @@ -37,13 +37,23 @@ public ServerPropertiesForGeoRestore() /// The source server id to restore /// from. /// Server version. Possible values include: - /// '9.5', '9.6', '10', '10.0', '10.2' + /// '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?), StorageProfile storageProfile = default(StorageProfile)) - : base(version, sslEnforcement, storageProfile) + 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(); diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForReplica.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForReplica.cs similarity index 69% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForReplica.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForReplica.cs index 994f08f9b9e6c..263423778b47b 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForReplica.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForReplica.cs @@ -34,13 +34,23 @@ public ServerPropertiesForReplica() /// The master server id to create replica /// from. /// Server version. Possible values include: - /// '9.5', '9.6', '10', '10.0', '10.2' + /// '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?), StorageProfile storageProfile = default(StorageProfile)) - : base(version, sslEnforcement, storageProfile) + 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(); diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForRestore.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForRestore.cs similarity index 74% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForRestore.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForRestore.cs index 534c4017d197a..267d2054da1c1 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForRestore.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerPropertiesForRestore.cs @@ -36,13 +36,23 @@ public ServerPropertiesForRestore() /// 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' + /// '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?), StorageProfile storageProfile = default(StorageProfile)) - : base(version, sslEnforcement, storageProfile) + 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; diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerSecurityAlertPolicy.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerSecurityAlertPolicy.cs similarity index 92% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerSecurityAlertPolicy.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerSecurityAlertPolicy.cs index c6c4368fc399e..06b616df3135d 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerSecurityAlertPolicy.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerSecurityAlertPolicy.cs @@ -37,9 +37,12 @@ public ServerSecurityAlertPolicy() /// Specifies the state of the policy, whether it /// is enabled or disabled. Possible values include: 'Enabled', /// 'Disabled' - /// Resource ID - /// Resource name. - /// Resource type. + /// 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 diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerSecurityAlertPolicyState.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerSecurityAlertPolicyState.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerSecurityAlertPolicyState.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerSecurityAlertPolicyState.cs diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerState.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerState.cs similarity index 92% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerState.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerState.cs index a3b2bf28dbb47..024c8530e8bf0 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerState.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerState.cs @@ -19,5 +19,6 @@ public static class ServerState public const string Ready = "Ready"; public const string Dropping = "Dropping"; public const string Disabled = "Disabled"; + public const string Inaccessible = "Inaccessible"; } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerUpdateParameters.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerUpdateParameters.cs similarity index 65% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerUpdateParameters.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerUpdateParameters.cs index 125c70a21b090..52022e31dfcb1 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerUpdateParameters.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerUpdateParameters.cs @@ -34,26 +34,38 @@ public ServerUpdateParameters() /// /// 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' + /// 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(Sku sku = default(Sku), StorageProfile storageProfile = default(StorageProfile), string administratorLoginPassword = default(string), string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), string replicationRole = default(string), IDictionary tags = default(IDictionary)) + 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(); @@ -64,6 +76,12 @@ public ServerUpdateParameters() /// 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. /// @@ -84,7 +102,7 @@ public ServerUpdateParameters() /// /// Gets or sets the version of a server. Possible values include: - /// '9.5', '9.6', '10', '10.0', '10.2' + /// '9.5', '9.6', '10', '10.0', '10.2', '11' /// [JsonProperty(PropertyName = "properties.version")] public string Version { get; set; } @@ -96,6 +114,22 @@ public ServerUpdateParameters() [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. /// diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerVersion.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerVersion.cs similarity index 94% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerVersion.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerVersion.cs index 7b9d6a2352fbf..195c933c4628a 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerVersion.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerVersion.cs @@ -21,5 +21,6 @@ public static class ServerVersion public const string OneZero = "10"; public const string OneZeroFullStopZero = "10.0"; public const string OneZeroFullStopTwo = "10.2"; + public const string OneOne = "11"; } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Sku.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Sku.cs similarity index 91% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Sku.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Sku.cs index 05ac437482873..a38e9ed36c75f 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Sku.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Sku.cs @@ -40,7 +40,7 @@ public Sku() /// The size code, to be interpreted by resource as /// appropriate. /// The family of hardware. - public Sku(string name = default(string), string tier = default(string), int? capacity = default(int?), string size = default(string), string family = default(string)) + public Sku(string name, string tier = default(string), int? capacity = default(int?), string size = default(string), string family = default(string)) { Name = name; Tier = tier; @@ -97,6 +97,10 @@ public Sku() /// public virtual void Validate() { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } if (Capacity < 0) { throw new ValidationException(ValidationRules.InclusiveMinimum, "Capacity", 0); diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/SkuTier.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/SkuTier.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/SkuTier.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/SkuTier.cs diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/SslEnforcementEnum.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/SslEnforcementEnum.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/SslEnforcementEnum.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/SslEnforcementEnum.cs 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/StorageAutogrow.cs new file mode 100644 index 0000000000000..4fb501782f93d --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/StorageAutogrow.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.Models +{ + + /// + /// Defines values for StorageAutogrow. + /// + public static class StorageAutogrow + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/StorageProfile.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/StorageProfile.cs similarity index 82% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/StorageProfile.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/StorageProfile.cs index e4b5fa78e581f..568db7f42c3ba 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/StorageProfile.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/StorageProfile.cs @@ -35,11 +35,14 @@ public StorageProfile() /// server backup. Possible values include: 'Enabled', /// 'Disabled' /// Max storage allowed for a server. - public StorageProfile(int? backupRetentionDays = default(int?), string geoRedundantBackup = default(string), int? storageMB = default(int?)) + /// 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)) { BackupRetentionDays = backupRetentionDays; GeoRedundantBackup = geoRedundantBackup; StorageMB = storageMB; + StorageAutogrow = storageAutogrow; CustomInit(); } @@ -67,5 +70,12 @@ public StorageProfile() [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; } + } } 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/TagsObject.cs new file mode 100644 index 0000000000000..b1b7e3cfab0a2 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/TagsObject.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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Tags object for patch operations. + /// + public partial class TagsObject + { + /// + /// Initializes a new instance of the TagsObject class. + /// + public TagsObject() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TagsObject class. + /// + /// Resource tags. + public TagsObject(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/TrackedResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/TrackedResource.cs similarity index 71% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/TrackedResource.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/TrackedResource.cs index 4231b126e6c89..f76bdf2825eca 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/TrackedResource.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/TrackedResource.cs @@ -17,9 +17,9 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models using System.Linq; /// - /// Resource properties including location and tags for track resources. + /// The resource model definition for a ARM tracked top level resource /// - public partial class TrackedResource : ProxyResource + public partial class TrackedResource : Resource { /// /// Initializes a new instance of the TrackedResource class. @@ -32,18 +32,20 @@ public TrackedResource() /// /// Initializes a new instance of the TrackedResource class. /// - /// The location the resource resides - /// in. - /// Resource ID - /// Resource name. - /// Resource type. - /// Application-specific metadata in the form of - /// key-value pairs. + /// The geo-location where the resource + /// lives + /// 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. + /// 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) { - Location = location; Tags = tags; + Location = location; CustomInit(); } @@ -53,17 +55,16 @@ public TrackedResource() partial void CustomInit(); /// - /// Gets or sets the location the resource resides in. + /// Gets or sets resource tags. /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } /// - /// Gets or sets application-specific metadata in the form of key-value - /// pairs. + /// Gets or sets the geo-location where the resource lives /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } /// /// Validate the object. diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/VirtualNetworkRule.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkRule.cs similarity index 88% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/VirtualNetworkRule.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkRule.cs index 8f132417371eb..cffba1a1967da 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/VirtualNetworkRule.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkRule.cs @@ -34,9 +34,12 @@ public VirtualNetworkRule() /// /// The ARM resource id of the /// virtual network subnet. - /// Resource ID - /// Resource name. - /// Resource type. + /// 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. diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/VirtualNetworkRuleState.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkRuleState.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/VirtualNetworkRuleState.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkRuleState.cs 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 new file mode 100644 index 0000000000000..e27b3730208bd --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Operations.cs @@ -0,0 +1,219 @@ +// +// 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; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(PostgreSQLManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the PostgreSQLManagementClient + /// + public PostgreSQLManagementClient Client { get; private set; } + + /// + /// Lists all of the available REST API operations. + /// + /// + /// 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 + /// + /// + /// 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"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _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(); + 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/Generated/OperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/OperationsExtensions.cs similarity index 100% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/OperationsExtensions.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/OperationsExtensions.cs diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/PostgreSQLManagementClient.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PostgreSQLManagementClient.cs similarity index 94% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/PostgreSQLManagementClient.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PostgreSQLManagementClient.cs index 8354f1114cdca..0c38d863f8a79 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/PostgreSQLManagementClient.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PostgreSQLManagementClient.cs @@ -50,15 +50,10 @@ public partial class PostgreSQLManagementClient : ServiceClient - /// The subscription ID that identifies an Azure subscription. + /// The ID of the target subscription. /// public string SubscriptionId { get; set; } - /// - /// The API version to use for the request. - /// - public string ApiVersion { get; private set; } - /// /// The preferred language for the response. /// @@ -112,6 +107,11 @@ public partial class PostgreSQLManagementClient : ServiceClient public virtual ILogFilesOperations LogFiles { get; private set; } + /// + /// Gets the IServerAdministratorsOperations. + /// + public virtual IServerAdministratorsOperations ServerAdministrators { get; private set; } + /// /// Gets the ILocationBasedPerformanceTierOperations. /// @@ -122,15 +122,30 @@ public partial class PostgreSQLManagementClient : ServiceClient public virtual ICheckNameAvailabilityOperations CheckNameAvailability { get; private set; } + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + /// /// Gets the IServerSecurityAlertPoliciesOperations. /// public virtual IServerSecurityAlertPoliciesOperations ServerSecurityAlertPolicies { get; private set; } /// - /// Gets the IOperations. + /// Gets the IPrivateEndpointConnectionsOperations. /// - public virtual IOperations Operations { get; private set; } + public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } + + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } + + /// + /// Gets the IServerKeysOperations. + /// + public virtual IServerKeysOperations ServerKeys { get; private set; } /// /// Initializes a new instance of the PostgreSQLManagementClient class. @@ -380,12 +395,15 @@ private void Initialize() Databases = new DatabasesOperations(this); Configurations = new ConfigurationsOperations(this); LogFiles = new LogFilesOperations(this); + ServerAdministrators = new ServerAdministratorsOperations(this); LocationBasedPerformanceTier = new LocationBasedPerformanceTierOperations(this); CheckNameAvailability = new CheckNameAvailabilityOperations(this); - ServerSecurityAlertPolicies = new ServerSecurityAlertPoliciesOperations(this); Operations = new Operations(this); + ServerSecurityAlertPolicies = new ServerSecurityAlertPoliciesOperations(this); + PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); + PrivateLinkResources = new PrivateLinkResourcesOperations(this); + ServerKeys = new ServerKeysOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2017-12-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; 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 new file mode 100644 index 0000000000000..ce6bec612f892 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PrivateEndpointConnectionsOperations.cs @@ -0,0 +1,1435 @@ +// +// 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 new file mode 100644 index 0000000000000..2d26956c7dc8d --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PrivateEndpointConnectionsOperationsExtensions.cs @@ -0,0 +1,439 @@ +// +// 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 new file mode 100644 index 0000000000000..39f329b8db20b --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PrivateLinkResourcesOperations.cs @@ -0,0 +1,668 @@ +// +// 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 new file mode 100644 index 0000000000000..e274e4b97ab0a --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PrivateLinkResourcesOperationsExtensions.cs @@ -0,0 +1,145 @@ +// +// 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/Generated/ReplicasOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ReplicasOperations.cs similarity index 89% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ReplicasOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ReplicasOperations.cs index 15c6e3d417eaa..3dc09ffea7427 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ReplicasOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ReplicasOperations.cs @@ -54,8 +54,7 @@ internal ReplicasOperations(PostgreSQLManagementClient client) /// List all the replicas for a given server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -83,22 +82,41 @@ internal ReplicasOperations(PostgreSQLManagementClient client) /// 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.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; @@ -106,6 +124,7 @@ internal ReplicasOperations(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); @@ -113,14 +132,14 @@ internal ReplicasOperations(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}/Replicas").ToString(); + 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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ReplicasOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ReplicasOperationsExtensions.cs similarity index 88% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ReplicasOperationsExtensions.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ReplicasOperationsExtensions.cs index fa54cfe93b2f0..6e80270ae7106 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ReplicasOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ReplicasOperationsExtensions.cs @@ -30,8 +30,7 @@ public static partial class ReplicasOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -48,8 +47,7 @@ public static IEnumerable ListByServer(this IReplicasOperations operatio /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. 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 new file mode 100644 index 0000000000000..91c35835f5859 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/SdkInfo_PostgreSQLManagementClient.cs @@ -0,0 +1,52 @@ + +// +// 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 System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_PostgreSQLManagementClient + { + get + { + 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"), + }.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 new file mode 100644 index 0000000000000..a8aa258bcde2e --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerAdministratorsOperations.cs @@ -0,0 +1,984 @@ +// +// 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 new file mode 100644 index 0000000000000..e8d55f93089c5 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerAdministratorsOperationsExtensions.cs @@ -0,0 +1,281 @@ +// +// 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 new file mode 100644 index 0000000000000..c47ec054c22e5 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerKeysOperations.cs @@ -0,0 +1,1184 @@ +// +// 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 new file mode 100644 index 0000000000000..cbcd8adb0b4ca --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerKeysOperationsExtensions.cs @@ -0,0 +1,339 @@ +// +// 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/Generated/ServerSecurityAlertPoliciesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperations.cs similarity index 89% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerSecurityAlertPoliciesOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperations.cs index a2c21dec6ed09..37e18c157e871 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerSecurityAlertPoliciesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperations.cs @@ -54,8 +54,7 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client /// Get a server's security alert policy. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -87,6 +86,21 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client { 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"); @@ -95,11 +109,15 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ApiVersion == null) + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + 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; @@ -110,6 +128,7 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -121,9 +140,9 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client _url = _url.Replace("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -254,8 +273,7 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client /// Creates or updates a threat detection policy. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -280,8 +298,7 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client /// Creates or updates a threat detection policy. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -316,6 +333,21 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client { 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"); @@ -332,11 +364,15 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ApiVersion == null) + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + 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; @@ -348,6 +384,7 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client tracingParameters.Add("serverName", serverName); tracingParameters.Add("securityAlertPolicyName", securityAlertPolicyName); tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -359,9 +396,9 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client _url = _url.Replace("{securityAlertPolicyName}", System.Uri.EscapeDataString(securityAlertPolicyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerSecurityAlertPoliciesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperationsExtensions.cs similarity index 87% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerSecurityAlertPoliciesOperationsExtensions.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperationsExtensions.cs index 2275799343f69..fa076ed76475f 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerSecurityAlertPoliciesOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperationsExtensions.cs @@ -28,8 +28,7 @@ public static partial class ServerSecurityAlertPoliciesOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -46,8 +45,7 @@ public static ServerSecurityAlertPolicy Get(this IServerSecurityAlertPoliciesOpe /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -70,8 +68,7 @@ public static ServerSecurityAlertPolicy Get(this IServerSecurityAlertPoliciesOpe /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -91,8 +88,7 @@ public static ServerSecurityAlertPolicy CreateOrUpdate(this IServerSecurityAlert /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -118,8 +114,7 @@ public static ServerSecurityAlertPolicy CreateOrUpdate(this IServerSecurityAlert /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -139,8 +134,7 @@ public static ServerSecurityAlertPolicy BeginCreateOrUpdate(this IServerSecurity /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServersOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServersOperations.cs similarity index 88% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServersOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServersOperations.cs index c26fccb207aab..a7b8dd055e79e 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServersOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServersOperations.cs @@ -54,8 +54,7 @@ internal ServersOperations(PostgreSQLManagementClient client) /// Creates a new server, or will overwrite an existing server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -81,8 +80,7 @@ internal ServersOperations(PostgreSQLManagementClient client) /// properties present in the normal server definition. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -107,8 +105,7 @@ internal ServersOperations(PostgreSQLManagementClient client) /// Deletes a server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -130,8 +127,7 @@ internal ServersOperations(PostgreSQLManagementClient client) /// Gets information about a server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -159,22 +155,41 @@ 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.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; @@ -182,6 +197,7 @@ 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); @@ -189,14 +205,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/servers/{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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -327,8 +343,7 @@ internal ServersOperations(PostgreSQLManagementClient client) /// List all the servers in a given resource group. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// Headers that will be added to request. @@ -353,18 +368,37 @@ internal ServersOperations(PostgreSQLManagementClient client) /// 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.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 = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -372,19 +406,20 @@ 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/servers").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -537,14 +572,18 @@ internal ServersOperations(PostgreSQLManagementClient client) /// 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.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; @@ -552,17 +591,18 @@ 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/servers").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -693,8 +733,7 @@ internal ServersOperations(PostgreSQLManagementClient client) /// Restarts a server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -716,8 +755,7 @@ internal ServersOperations(PostgreSQLManagementClient client) /// Creates a new server, or will overwrite an existing server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -748,18 +786,36 @@ internal ServersOperations(PostgreSQLManagementClient client) /// public async Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerForCreate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } 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"); @@ -772,6 +828,7 @@ internal ServersOperations(PostgreSQLManagementClient client) { parameters.Validate(); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -779,6 +836,7 @@ 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); @@ -787,14 +845,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/servers/{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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -950,8 +1008,7 @@ internal ServersOperations(PostgreSQLManagementClient client) /// properties present in the normal server definition. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -982,18 +1039,36 @@ internal ServersOperations(PostgreSQLManagementClient client) /// public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } 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"); @@ -1002,6 +1077,7 @@ internal ServersOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1009,6 +1085,7 @@ 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); @@ -1017,14 +1094,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/servers/{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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -1161,8 +1238,7 @@ internal ServersOperations(PostgreSQLManagementClient client) /// Deletes a server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -1187,22 +1263,41 @@ 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.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; @@ -1210,6 +1305,7 @@ 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); @@ -1217,14 +1313,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/servers/{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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -1337,8 +1433,7 @@ internal ServersOperations(PostgreSQLManagementClient client) /// Restarts a server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -1363,22 +1458,41 @@ internal ServersOperations(PostgreSQLManagementClient client) /// public async Task BeginRestartWithHttpMessagesAsync(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.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; @@ -1386,6 +1500,7 @@ 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); @@ -1393,14 +1508,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}/restart").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServersOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServersOperationsExtensions.cs similarity index 85% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServersOperationsExtensions.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServersOperationsExtensions.cs index 66e13411c10ad..c3e2c002f68e8 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServersOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServersOperationsExtensions.cs @@ -30,8 +30,7 @@ public static partial class ServersOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -51,8 +50,7 @@ public static Server Create(this IServersOperations operations, string resourceG /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -79,8 +77,7 @@ public static Server Create(this IServersOperations operations, string resourceG /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -101,8 +98,7 @@ public static Server Update(this IServersOperations operations, string resourceG /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -128,8 +124,7 @@ public static Server Update(this IServersOperations operations, string resourceG /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -146,8 +141,7 @@ public static void Delete(this IServersOperations operations, string resourceGro /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -167,8 +161,7 @@ public static void Delete(this IServersOperations operations, string resourceGro /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -185,8 +178,7 @@ public static Server Get(this IServersOperations operations, string resourceGrou /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -209,8 +201,7 @@ public static Server Get(this IServersOperations operations, string resourceGrou /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// public static IEnumerable ListByResourceGroup(this IServersOperations operations, string resourceGroupName) { @@ -224,8 +215,7 @@ public static IEnumerable ListByResourceGroup(this IServersOperations op /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The cancellation token. @@ -273,8 +263,7 @@ public static IEnumerable List(this IServersOperations operations) /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -291,8 +280,7 @@ public static void Restart(this IServersOperations operations, string resourceGr /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -312,8 +300,7 @@ public static void Restart(this IServersOperations operations, string resourceGr /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -333,8 +320,7 @@ public static Server BeginCreate(this IServersOperations operations, string reso /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -361,8 +347,7 @@ public static Server BeginCreate(this IServersOperations operations, string reso /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -383,8 +368,7 @@ public static Server BeginUpdate(this IServersOperations operations, string reso /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -410,8 +394,7 @@ public static Server BeginUpdate(this IServersOperations operations, string reso /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -428,8 +411,7 @@ public static void BeginDelete(this IServersOperations operations, string resour /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -449,8 +431,7 @@ public static void BeginDelete(this IServersOperations operations, string resour /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -467,8 +448,7 @@ public static void BeginRestart(this IServersOperations operations, string resou /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/VirtualNetworkRulesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/VirtualNetworkRulesOperations.cs similarity index 90% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/VirtualNetworkRulesOperations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/VirtualNetworkRulesOperations.cs index 3a7050e303869..b33e438915223 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/VirtualNetworkRulesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/VirtualNetworkRulesOperations.cs @@ -54,8 +54,7 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) /// Gets a virtual network rule. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -90,6 +89,21 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) { 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"); @@ -98,14 +112,18 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ApiVersion == null) + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + 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; @@ -115,21 +133,22 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) 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(); + 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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -260,8 +279,7 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) /// Creates or updates an existing virtual network rule. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -289,8 +307,7 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) /// Deletes the virtual network rule with the given name. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -315,8 +332,7 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) /// Gets a list of virtual network rules in a server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -348,6 +364,21 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) { 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"); @@ -356,10 +387,14 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ApiVersion == null) + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + 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; @@ -369,19 +404,20 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) 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(); + 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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -512,8 +548,7 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) /// Creates or updates an existing virtual network rule. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -551,6 +586,21 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) { 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"); @@ -559,9 +609,12 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ApiVersion == null) + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } } if (virtualNetworkRuleName == null) { @@ -575,6 +628,7 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) { parameters.Validate(); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -584,6 +638,7 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) 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); @@ -591,15 +646,15 @@ internal VirtualNetworkRulesOperations(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}/virtualNetworkRules/{virtualNetworkRuleName}").ToString(); + 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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -754,8 +809,7 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) /// Deletes the virtual network rule with the given name. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -787,6 +841,21 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) { 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"); @@ -799,10 +868,14 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ApiVersion == null) + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + 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; @@ -813,20 +886,21 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) 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(); + 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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/VirtualNetworkRulesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/VirtualNetworkRulesOperationsExtensions.cs similarity index 88% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/VirtualNetworkRulesOperationsExtensions.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/VirtualNetworkRulesOperationsExtensions.cs index 85a0537b7116a..7187020c0145f 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/VirtualNetworkRulesOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/VirtualNetworkRulesOperationsExtensions.cs @@ -28,8 +28,7 @@ public static partial class VirtualNetworkRulesOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -49,8 +48,7 @@ public static VirtualNetworkRule Get(this IVirtualNetworkRulesOperations operati /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -76,8 +74,7 @@ public static VirtualNetworkRule Get(this IVirtualNetworkRulesOperations operati /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -100,8 +97,7 @@ public static VirtualNetworkRule CreateOrUpdate(this IVirtualNetworkRulesOperati /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -130,8 +126,7 @@ public static VirtualNetworkRule CreateOrUpdate(this IVirtualNetworkRulesOperati /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -151,8 +146,7 @@ public static void Delete(this IVirtualNetworkRulesOperations operations, string /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -175,8 +169,7 @@ public static void Delete(this IVirtualNetworkRulesOperations operations, string /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -193,8 +186,7 @@ public static IPage ListByServer(this IVirtualNetworkRulesOp /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -217,8 +209,7 @@ public static IPage ListByServer(this IVirtualNetworkRulesOp /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -241,8 +232,7 @@ public static VirtualNetworkRule BeginCreateOrUpdate(this IVirtualNetworkRulesOp /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -271,8 +261,7 @@ public static VirtualNetworkRule BeginCreateOrUpdate(this IVirtualNetworkRulesOp /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -292,8 +281,7 @@ public static void BeginDelete(this IVirtualNetworkRulesOperations operations, s /// The operations group for this extension method. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/CheckNameAvailabilityOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/CheckNameAvailabilityOperations.cs new file mode 100644 index 0000000000000..335ed3a01279c --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/CheckNameAvailabilityOperations.cs @@ -0,0 +1,264 @@ +// +// 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.FlexibleServers +{ + 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; + + /// + /// CheckNameAvailabilityOperations operations. + /// + internal partial class CheckNameAvailabilityOperations : IServiceOperations, ICheckNameAvailabilityOperations + { + /// + /// Initializes a new instance of the CheckNameAvailabilityOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CheckNameAvailabilityOperations(PostgreSQLManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the PostgreSQLManagementClient + /// + public PostgreSQLManagementClient Client { get; private set; } + + /// + /// Check the availability of name for resource + /// + /// + /// The required parameters for checking if resource name is available. + /// + /// + /// 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> 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"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (nameAvailabilityRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nameAvailabilityRequest"); + } + if (nameAvailabilityRequest != null) + { + nameAvailabilityRequest.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + 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(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(nameAvailabilityRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(nameAvailabilityRequest, 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; + } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/CheckNameAvailabilityOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/CheckNameAvailabilityOperationsExtensions.cs new file mode 100644 index 0000000000000..8990bc47b13f3 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/CheckNameAvailabilityOperationsExtensions.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.FlexibleServers +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CheckNameAvailabilityOperations. + /// + public static partial class CheckNameAvailabilityOperationsExtensions + { + /// + /// Check the availability of name for resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The required parameters for checking if resource name is available. + /// + public static NameAvailability Execute(this ICheckNameAvailabilityOperations operations, NameAvailabilityRequest nameAvailabilityRequest) + { + return operations.ExecuteAsync(nameAvailabilityRequest).GetAwaiter().GetResult(); + } + + /// + /// Check the availability of name for resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The required parameters for checking if resource name is available. + /// + /// + /// The cancellation token. + /// + public static async Task ExecuteAsync(this ICheckNameAvailabilityOperations operations, NameAvailabilityRequest nameAvailabilityRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ExecuteWithHttpMessagesAsync(nameAvailabilityRequest, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/ConfigurationsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/ConfigurationsOperations.cs new file mode 100644 index 0000000000000..62c589a978c78 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/ConfigurationsOperations.cs @@ -0,0 +1,962 @@ +// +// 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.FlexibleServers +{ + 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; + + /// + /// ConfigurationsOperations operations. + /// + internal partial class ConfigurationsOperations : IServiceOperations, IConfigurationsOperations + { + /// + /// Initializes a new instance of the ConfigurationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ConfigurationsOperations(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 configurations in 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.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 + 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 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. + /// + /// + /// 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 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"); + } + 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 (configurationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "configurationName"); + } + // 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("configurationName", configurationName); + 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/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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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; + } + + /// + /// 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. + /// + /// + /// 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. + /// + /// + /// 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> 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"); + } + 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 (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; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("configurationName", configurationName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + 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/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 (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("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 && (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; + } + + /// + /// 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/postgresqlflexibleservers/Generated/ConfigurationsOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/ConfigurationsOperationsExtensions.cs new file mode 100644 index 0000000000000..7f5d520e8a4f5 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/ConfigurationsOperationsExtensions.cs @@ -0,0 +1,249 @@ +// +// 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.FlexibleServers +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ConfigurationsOperations. + /// + 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. + /// + /// + /// 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 required parameters for updating a server configuration. + /// + public static Configuration Update(this IConfigurationsOperations operations, string resourceGroupName, string serverName, string configurationName, Configuration parameters) + { + return operations.UpdateAsync(resourceGroupName, serverName, configurationName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a configuration of 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 name of the server configuration. + /// + /// + /// The required parameters for updating a server configuration. + /// + /// + /// The cancellation token. + /// + 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.UpdateWithHttpMessagesAsync(resourceGroupName, serverName, configurationName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a configuration of 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 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.BeginUpdateAsync(resourceGroupName, serverName, configurationName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a configuration of 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 name of the server configuration. + /// + /// + /// The required parameters for updating a server configuration. + /// + /// + /// The cancellation token. + /// + 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.BeginUpdateWithHttpMessagesAsync(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.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/FirewallRulesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/FirewallRulesOperations.cs new file mode 100644 index 0000000000000..fd57265438a31 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/FirewallRulesOperations.cs @@ -0,0 +1,1222 @@ +// +// 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.FlexibleServers +{ + 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; + + /// + /// FirewallRulesOperations operations. + /// + internal partial class FirewallRulesOperations : IServiceOperations, IFirewallRulesOperations + { + /// + /// Initializes a new instance of the FirewallRulesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal FirewallRulesOperations(PostgreSQLManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the PostgreSQLManagementClient + /// + public PostgreSQLManagementClient Client { get; private set; } + + /// + /// Creates a new firewall rule or updates an existing firewall rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The name of the server firewall rule. + /// + /// + /// The required parameters for creating or updating a firewall rule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, FirewallRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a PostgreSQL server firewall rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The name of the server firewall rule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List all the firewall rules in a given server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The name of the server firewall 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 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"); + } + 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 (firewallRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName"); + } + // 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("firewallRuleName", firewallRuleName); + 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/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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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 firewall rules in a given 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 (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}/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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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 a new firewall rule or updates an existing firewall rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The name of the server firewall rule. + /// + /// + /// The required parameters for creating or updating a firewall 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> 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"); + } + 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 (firewallRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // 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("firewallRuleName", firewallRuleName); + 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/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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(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 a PostgreSQL server firewall rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The name of the server firewall 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 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"); + } + 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 (firewallRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName"); + } + // 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("firewallRuleName", firewallRuleName); + 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/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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 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; + } + + /// + /// 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/postgresqlflexibleservers/Generated/FirewallRulesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/FirewallRulesOperationsExtensions.cs new file mode 100644 index 0000000000000..25410b51cd999 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/FirewallRulesOperationsExtensions.cs @@ -0,0 +1,335 @@ +// +// 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.FlexibleServers +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for FirewallRulesOperations. + /// + public static partial class FirewallRulesOperationsExtensions + { + /// + /// Creates a new firewall rule or updates an existing firewall 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 server firewall rule. + /// + /// + /// The required parameters for creating or updating a firewall rule. + /// + public static FirewallRule CreateOrUpdate(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, FirewallRule parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a new firewall rule or updates an existing firewall 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 server firewall rule. + /// + /// + /// The required parameters for creating or updating a firewall rule. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, FirewallRule parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a PostgreSQL server firewall 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 server firewall rule. + /// + public static void Delete(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName) + { + operations.DeleteAsync(resourceGroupName, serverName, firewallRuleName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a PostgreSQL server firewall 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 server firewall rule. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List all the firewall rules 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 name of the server firewall rule. + /// + public static FirewallRule Get(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName) + { + return operations.GetAsync(resourceGroupName, serverName, firewallRuleName).GetAwaiter().GetResult(); + } + + /// + /// List all the firewall rules 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 name of the server firewall rule. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List all the firewall rules in a given 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 IFirewallRulesOperations operations, string resourceGroupName, string serverName) + { + return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// List all the firewall rules in a given 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 IFirewallRulesOperations 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 a new firewall rule or updates an existing firewall 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 server firewall rule. + /// + /// + /// The required parameters for creating or updating a firewall rule. + /// + public static FirewallRule BeginCreateOrUpdate(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, FirewallRule parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a new firewall rule or updates an existing firewall 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 server firewall rule. + /// + /// + /// The required parameters for creating or updating a firewall rule. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, FirewallRule parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a PostgreSQL server firewall 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 server firewall rule. + /// + public static void BeginDelete(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName) + { + operations.BeginDeleteAsync(resourceGroupName, serverName, firewallRuleName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a PostgreSQL server firewall 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 server firewall rule. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + (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/postgresqlflexibleservers/Generated/ICheckNameAvailabilityOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/ICheckNameAvailabilityOperations.cs new file mode 100644 index 0000000000000..2a6c5ba96bcd4 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/ICheckNameAvailabilityOperations.cs @@ -0,0 +1,49 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.FlexibleServers +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CheckNameAvailabilityOperations operations. + /// + public partial interface ICheckNameAvailabilityOperations + { + /// + /// Check the availability of name for resource + /// + /// + /// The required parameters for checking if resource name is available. + /// + /// + /// 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(NameAvailabilityRequest nameAvailabilityRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/IConfigurationsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/IConfigurationsOperations.cs new file mode 100644 index 0000000000000..d20f0c95619fe --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/IConfigurationsOperations.cs @@ -0,0 +1,164 @@ +// +// 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.FlexibleServers +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ConfigurationsOperations operations. + /// + 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. + /// + /// + /// 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. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string configurationName, Configuration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(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/postgresqlflexibleservers/Generated/IFirewallRulesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/IFirewallRulesOperations.cs new file mode 100644 index 0000000000000..498378aa0e008 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/IFirewallRulesOperations.cs @@ -0,0 +1,214 @@ +// +// 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.FlexibleServers +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// FirewallRulesOperations operations. + /// + public partial interface IFirewallRulesOperations + { + /// + /// Creates a new firewall rule or updates an existing firewall rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The name of the server firewall rule. + /// + /// + /// The required parameters for creating or updating a firewall 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, FirewallRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a PostgreSQL server firewall rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The name of the server firewall 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 firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all the firewall rules in a given server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The name of the server firewall 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 firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all the firewall rules in a given 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)); + /// + /// Creates a new firewall rule or updates an existing firewall rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The name of the server firewall rule. + /// + /// + /// The required parameters for creating or updating a firewall 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, FirewallRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a PostgreSQL server firewall rule. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The name of the server firewall 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 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/postgresqlflexibleservers/Generated/ILocationBasedCapabilitiesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/ILocationBasedCapabilitiesOperations.cs new file mode 100644 index 0000000000000..81dedc54dcb10 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/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.FlexibleServers +{ + 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/postgresqlflexibleservers/Generated/IOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/IOperations.cs new file mode 100644 index 0000000000000..9c766bb973594 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/IOperations.cs @@ -0,0 +1,46 @@ +// +// 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.FlexibleServers +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Lists all of the available REST API operations. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/IPostgreSQLManagementClient.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/IPostgreSQLManagementClient.cs new file mode 100644 index 0000000000000..990b1af8dca5a --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/IPostgreSQLManagementClient.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.FlexibleServers +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// The Microsoft Azure management API provides create, read, update, and + /// delete functionality for Azure PostgreSQL resources including servers, + /// databases, firewall rules, VNET rules, security alert policies, log + /// files and configurations with new business model. + /// + public partial interface IPostgreSQLManagementClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// The API version to use for this operation. + /// + string ApiVersion { get; } + + /// + /// The ID of the target subscription. + /// + string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IServersOperations. + /// + IServersOperations Servers { get; } + + /// + /// Gets the IFirewallRulesOperations. + /// + IFirewallRulesOperations FirewallRules { get; } + + /// + /// Gets the IConfigurationsOperations. + /// + IConfigurationsOperations Configurations { get; } + + /// + /// Gets the IServerKeysOperations. + /// + IServerKeysOperations ServerKeys { get; } + + /// + /// Gets the ICheckNameAvailabilityOperations. + /// + ICheckNameAvailabilityOperations CheckNameAvailability { get; } + + /// + /// Gets the ILocationBasedCapabilitiesOperations. + /// + ILocationBasedCapabilitiesOperations LocationBasedCapabilities { get; } + + /// + /// Gets the IVirtualNetworkSubnetUsageOperations. + /// + IVirtualNetworkSubnetUsageOperations VirtualNetworkSubnetUsage { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/IServerKeysOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/IServerKeysOperations.cs new file mode 100644 index 0000000000000..6eced938ac8df --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/IServerKeysOperations.cs @@ -0,0 +1,216 @@ +// +// 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.FlexibleServers +{ + 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/postgresqlflexibleservers/Generated/IServersOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/IServersOperations.cs new file mode 100644 index 0000000000000..5b4f90a77a982 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/IServersOperations.cs @@ -0,0 +1,427 @@ +// +// 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.FlexibleServers +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ServersOperations operations. + /// + public partial interface IServersOperations + { + /// + /// Creates a new server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The required parameters for creating or updating a 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> 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. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The required parameters for updating a 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerForUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes 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 DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets information about 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> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all the servers in a given resource group. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all the servers in a given subscription. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restarts 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 RestartWithHttpMessagesAsync(string resourceGroupName, string serverName, 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. + /// + /// + /// 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. + /// + /// + /// The name of the server. + /// + /// + /// The required parameters for creating or updating a 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> 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. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The required parameters for updating a 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerForUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restarts 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 BeginRestartWithHttpMessagesAsync(string resourceGroupName, string serverName, 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. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + 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/postgresqlflexibleservers/Generated/IVirtualNetworkSubnetUsageOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/IVirtualNetworkSubnetUsageOperations.cs new file mode 100644 index 0000000000000..0f2575c5160a4 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/IVirtualNetworkSubnetUsageOperations.cs @@ -0,0 +1,52 @@ +// +// 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.FlexibleServers +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualNetworkSubnetUsageOperations operations. + /// + public partial interface IVirtualNetworkSubnetUsageOperations + { + /// + /// 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. + /// + /// + /// 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, VirtualNetworkSubnetUsageParameter parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/LocationBasedCapabilitiesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/LocationBasedCapabilitiesOperations.cs new file mode 100644 index 0000000000000..ebb792e8583aa --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/LocationBasedCapabilitiesOperations.cs @@ -0,0 +1,428 @@ +// +// 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.FlexibleServers +{ + 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; + + /// + /// LocationBasedCapabilitiesOperations operations. + /// + internal partial class LocationBasedCapabilitiesOperations : IServiceOperations, ILocationBasedCapabilitiesOperations + { + /// + /// Initializes a new instance of the LocationBasedCapabilitiesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal LocationBasedCapabilitiesOperations(PostgreSQLManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the PostgreSQLManagementClient + /// + public PostgreSQLManagementClient Client { get; private set; } + + /// + /// Get capabilities at specified location in a given subscription. + /// + /// + /// The name of the location. + /// + /// + /// 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>> ExecuteWithHttpMessagesAsync(string locationName, 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 (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + 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/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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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; + } + + /// + /// Get capabilities at specified location 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>> ExecuteNextWithHttpMessagesAsync(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, "ExecuteNext", 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/postgresqlflexibleservers/Generated/LocationBasedCapabilitiesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/LocationBasedCapabilitiesOperationsExtensions.cs new file mode 100644 index 0000000000000..83017af3c398a --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/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.FlexibleServers +{ + 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/postgresqlflexibleservers/Generated/Models/AzureEntityResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/AzureEntityResource.cs new file mode 100644 index 0000000000000..832ace5659b81 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/AzureEntityResource.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.FlexibleServers.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource model definition for a Azure Resource Manager resource + /// with an etag. + /// + public partial class AzureEntityResource : Resource + { + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + public AzureEntityResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureEntityResource 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. + /// Resource Etag. + public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + : base(id, name, type) + { + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Etag. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/CapabilityProperties.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/CapabilityProperties.cs new file mode 100644 index 0000000000000..101078d1ddd57 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/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.FlexibleServers.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/postgresqlflexibleservers/Generated/Models/Configuration.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/Configuration.cs new file mode 100644 index 0000000000000..af252b7ca38c0 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/Configuration.cs @@ -0,0 +1,106 @@ +// +// 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.FlexibleServers.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a Configuration. + /// + [Rest.Serialization.JsonTransformation] + public partial class Configuration : ProxyResource + { + /// + /// Initializes a new instance of the Configuration class. + /// + public Configuration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Configuration 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. + /// Value of the configuration. + /// Description of the configuration. + /// Default value 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)) + : base(id, name, type) + { + Value = value; + Description = description; + DefaultValue = defaultValue; + DataType = dataType; + AllowedValues = allowedValues; + Source = source; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets value of the configuration. + /// + [JsonProperty(PropertyName = "properties.value")] + public string Value { get; set; } + + /// + /// Gets description of the configuration. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets default value of the configuration. + /// + [JsonProperty(PropertyName = "properties.defaultValue")] + public string DefaultValue { get; private set; } + + /// + /// Gets data type of the configuration. Possible values include: + /// 'Boolean', 'Numeric', 'Integer', 'Enumeration' + /// + [JsonProperty(PropertyName = "properties.dataType")] + public string DataType { get; private set; } + + /// + /// Gets allowed values of the configuration. + /// + [JsonProperty(PropertyName = "properties.allowedValues")] + public string AllowedValues { get; private set; } + + /// + /// Gets or sets source of the configuration. + /// + [JsonProperty(PropertyName = "properties.source")] + public string Source { get; set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ConfigurationDataType.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ConfigurationDataType.cs new file mode 100644 index 0000000000000..a16ab9141746c --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/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.FlexibleServers.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/postgresqlflexibleservers/Generated/Models/CreateMode.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/CreateMode.cs new file mode 100644 index 0000000000000..79b9c7c166f8a --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/CreateMode.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.FlexibleServers.Models +{ + + /// + /// Defines values for CreateMode. + /// + public static class CreateMode + { + public const string Default = "Default"; + public const string PointInTimeRestore = "PointInTimeRestore"; + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/DelegatedSubnetUsage.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/DelegatedSubnetUsage.cs new file mode 100644 index 0000000000000..01bd2fc57730a --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/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.FlexibleServers.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/postgresqlflexibleservers/Generated/Models/ErrorAdditionalInfo.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 0000000000000..42a4caf5d58f4 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ErrorAdditionalInfo.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.FlexibleServers.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource management error additional info. + /// + public partial class ErrorAdditionalInfo + { + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + public ErrorAdditionalInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + /// The additional info type. + /// The additional info. + public ErrorAdditionalInfo(string type = default(string), object info = default(object)) + { + Type = type; + Info = info; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the additional info type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the additional info. + /// + [JsonProperty(PropertyName = "info")] + public object Info { get; private set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ErrorResponse.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ErrorResponse.cs new file mode 100644 index 0000000000000..d69c84cb273df --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ErrorResponse.cs @@ -0,0 +1,85 @@ +// +// 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.FlexibleServers.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The resource management error response. + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The error code. + /// The error message. + /// The error target. + /// The error details. + /// The error additional info. + public ErrorResponse(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + AdditionalInfo = additionalInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the error target. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/FirewallRule.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/FirewallRule.cs new file mode 100644 index 0000000000000..ea28565e7904b --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/FirewallRule.cs @@ -0,0 +1,104 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.FlexibleServers.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a server firewall rule. + /// + [Rest.Serialization.JsonTransformation] + public partial class FirewallRule : ProxyResource + { + /// + /// Initializes a new instance of the FirewallRule class. + /// + public FirewallRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FirewallRule class. + /// + /// The start IP address of the server + /// 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 - + /// /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)) + : base(id, name, type) + { + StartIpAddress = startIpAddress; + EndIpAddress = endIpAddress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the start IP address of the server firewall rule. Must + /// be IPv4 format. + /// + [JsonProperty(PropertyName = "properties.startIpAddress")] + public string StartIpAddress { get; set; } + + /// + /// Gets or sets the end IP address of the server firewall rule. Must + /// be IPv4 format. + /// + [JsonProperty(PropertyName = "properties.endIpAddress")] + public string EndIpAddress { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StartIpAddress == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StartIpAddress"); + } + if (EndIpAddress == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "EndIpAddress"); + } + if (StartIpAddress != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(StartIpAddress, "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$")) + { + throw new ValidationException(ValidationRules.Pattern, "StartIpAddress", "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"); + } + } + if (EndIpAddress != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(EndIpAddress, "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$")) + { + throw new ValidationException(ValidationRules.Pattern, "EndIpAddress", "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"); + } + } + } + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/HAEnabledEnum.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/HAEnabledEnum.cs new file mode 100644 index 0000000000000..edb5090af8122 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/HAEnabledEnum.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.FlexibleServers.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for HAEnabledEnum. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum HAEnabledEnum + { + [EnumMember(Value = "Enabled")] + Enabled, + [EnumMember(Value = "Disabled")] + Disabled + } + internal static class HAEnabledEnumEnumExtension + { + internal static string ToSerializedValue(this HAEnabledEnum? value) + { + return value == null ? null : ((HAEnabledEnum)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this HAEnabledEnum value) + { + switch( value ) + { + case HAEnabledEnum.Enabled: + return "Enabled"; + case HAEnabledEnum.Disabled: + return "Disabled"; + } + return null; + } + + internal static HAEnabledEnum? ParseHAEnabledEnum(this string value) + { + switch( value ) + { + case "Enabled": + return HAEnabledEnum.Enabled; + case "Disabled": + return HAEnabledEnum.Disabled; + } + return null; + } + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/Identity.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/Identity.cs new file mode 100644 index 0000000000000..623fff21f1f4c --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/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.FlexibleServers.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/postgresqlflexibleservers/Generated/Models/MaintenanceWindow.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/MaintenanceWindow.cs new file mode 100644 index 0000000000000..31ec1af7c2d2c --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/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.FlexibleServers.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Maintenance window 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/postgresqlflexibleservers/Generated/Models/NameAvailability.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/NameAvailability.cs new file mode 100644 index 0000000000000..990a2c347b79d --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/NameAvailability.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.FlexibleServers.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a resource name availability. + /// + public partial class NameAvailability + { + /// + /// Initializes a new instance of the NameAvailability class. + /// + public NameAvailability() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NameAvailability class. + /// + /// Error Message. + /// Indicates whether the resource name is + /// available. + /// 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; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error Message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets indicates whether the resource name is available. + /// + [JsonProperty(PropertyName = "nameAvailable")] + public bool? NameAvailable { get; set; } + + /// + /// Gets or sets name of the PostgreSQL server. + /// + [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/postgresqlflexibleservers/Generated/Models/NameAvailabilityRequest.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/NameAvailabilityRequest.cs new file mode 100644 index 0000000000000..dedf8c9786a22 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/NameAvailabilityRequest.cs @@ -0,0 +1,73 @@ +// +// 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.FlexibleServers.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Request from client to check resource name availability. + /// + public partial class NameAvailabilityRequest + { + /// + /// Initializes a new instance of the NameAvailabilityRequest class. + /// + public NameAvailabilityRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NameAvailabilityRequest class. + /// + /// Resource name to verify. + /// Resource type used for verification. + public NameAvailabilityRequest(string name, string type = default(string)) + { + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource name to verify. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets resource type used for verification. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/Operation.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/Operation.cs new file mode 100644 index 0000000000000..d8ef4bdc1e40b --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/Operation.cs @@ -0,0 +1,84 @@ +// +// 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.FlexibleServers.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// REST API operation definition. + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + /// The name of the operation being performed on + /// this particular object. + /// The localized display information for this + /// particular operation or 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)) + { + Name = name; + Display = display; + Origin = origin; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the operation being performed on this particular + /// object. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the localized display information for this particular + /// operation or action. + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; private set; } + + /// + /// Gets the intended executor of the operation. Possible values + /// include: 'NotSpecified', 'user', 'system' + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; private set; } + + /// + /// Gets additional descriptions for the operation. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; private set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/OperationDisplay.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/OperationDisplay.cs new file mode 100644 index 0000000000000..402c735c5c34c --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/OperationDisplay.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.FlexibleServers.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Display metadata associated with the operation. + /// + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + /// Operation resource provider name. + /// Resource on which the operation is + /// performed. + /// Localized friendly name for the + /// operation. + /// Operation description. + public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets operation resource provider name. + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; private set; } + + /// + /// Gets resource on which the operation is performed. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; private set; } + + /// + /// Gets localized friendly name for the operation. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; private set; } + + /// + /// Gets operation description. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/OperationListResult.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/OperationListResult.cs new file mode 100644 index 0000000000000..4846839af3eba --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/OperationListResult.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.FlexibleServers.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of resource provider operations. + /// + public partial class OperationListResult + { + /// + /// Initializes a new instance of the OperationListResult class. + /// + public OperationListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationListResult class. + /// + /// The list of resource provider + /// operations. + public OperationListResult(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of resource provider operations. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/OperationOrigin.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/OperationOrigin.cs new file mode 100644 index 0000000000000..bf1597dddeb42 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/OperationOrigin.cs @@ -0,0 +1,23 @@ +// +// 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.FlexibleServers.Models +{ + + /// + /// Defines values for OperationOrigin. + /// + public static class OperationOrigin + { + public const string NotSpecified = "NotSpecified"; + public const string User = "user"; + public const string System = "system"; + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/Page.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/Page.cs new file mode 100644 index 0000000000000..b7d485ad01f5b --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/Page.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.FlexibleServers.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 Page : 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/postgresqlflexibleservers/Generated/Models/Plan.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/Plan.cs new file mode 100644 index 0000000000000..59d857a94464f --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/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.FlexibleServers.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/postgresqlflexibleservers/Generated/Models/ProxyResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ProxyResource.cs new file mode 100644 index 0000000000000..98c625b908511 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ProxyResource.cs @@ -0,0 +1,50 @@ +// +// 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.FlexibleServers.Models +{ + using System.Linq; + + /// + /// The resource model definition for a ARM proxy resource. It will have + /// everything other than required location and tags + /// + public partial class ProxyResource : Resource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource 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. + public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, 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/postgresqlflexibleservers/Generated/Models/Resource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/Resource.cs new file mode 100644 index 0000000000000..114b1bd5d0bb3 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/Resource.cs @@ -0,0 +1,72 @@ +// +// 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.FlexibleServers.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource 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. + public Resource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + 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. Ex- + /// 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/postgresqlflexibleservers/Generated/Models/ResourceIdentityType.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ResourceIdentityType.cs new file mode 100644 index 0000000000000..761fd25b52eab --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/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.FlexibleServers.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/postgresqlflexibleservers/Generated/Models/ResourceModelWithAllowedPropertySet.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ResourceModelWithAllowedPropertySet.cs new file mode 100644 index 0000000000000..7e92392030c61 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/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.FlexibleServers.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. Ex- + /// 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. Ex- + /// 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/postgresqlflexibleservers/Generated/Models/ResourceModelWithAllowedPropertySetIdentity.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ResourceModelWithAllowedPropertySetIdentity.cs new file mode 100644 index 0000000000000..838af20c1b52b --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/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.FlexibleServers.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/postgresqlflexibleservers/Generated/Models/ResourceModelWithAllowedPropertySetPlan.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ResourceModelWithAllowedPropertySetPlan.cs new file mode 100644 index 0000000000000..0fcea4ee366e6 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/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.FlexibleServers.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/postgresqlflexibleservers/Generated/Models/ResourceModelWithAllowedPropertySetSku.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ResourceModelWithAllowedPropertySetSku.cs new file mode 100644 index 0000000000000..9b40bddbe98a0 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/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.FlexibleServers.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/postgresqlflexibleservers/Generated/Models/Server.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/Server.cs new file mode 100644 index 0000000000000..c65845cab62c2 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/Server.cs @@ -0,0 +1,274 @@ +// +// 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.FlexibleServers.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a server. + /// + [Rest.Serialization.JsonTransformation] + public partial class Server : TrackedResource + { + /// + /// Initializes a new instance of the Server class. + /// + public Server() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Server class. + /// + /// The geo-location where the resource + /// lives + /// 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. + /// Resource tags. + /// The Azure Active Directory identity of the + /// server. + /// The SKU (pricing tier) of the server. + /// The administrator's login name of + /// a server. Can only be specified when the server is being created + /// (and is required for creation). + /// The administrator login + /// password (required for server creation). + /// PostgreSQL Server version. Possible values + /// include: '12', '11' + /// A state of a server that is visible to user. + /// Possible values include: 'Ready', 'Dropping', 'Disabled', + /// 'Starting', 'Stopping', 'Stopped', 'Updating' + /// A state of a HA server that is visible to + /// user. Possible values include: 'NotEnabled', 'CreatingStandby', + /// 'ReplicatingData', 'FailingOver', 'Healthy', + /// 'RemovingStandby' + /// The fully qualified domain + /// name of a server. + /// The display name of a server. + /// Storage profile of a server. + /// public network access is enabled + /// or not. Possible values include: 'Enabled', 'Disabled' + /// Maintenance window of a + /// server. + /// stand by count value can be either enabled + /// or disabled. Possible values include: 'Enabled', 'Disabled' + /// The source PostgreSQL server name to + /// restore from. + /// Restore point creation time (ISO8601 + /// format), specifying the time to restore from. + /// availability Zone information of the + /// server. + /// availability Zone information + /// of the server. + /// Status showing whether the data + /// encryption is enabled with customer-managed keys. + /// The mode to create a new PostgreSQL + /// server. Possible values include: 'Default', + /// 'PointInTimeRestore' + /// Application-specific metadata in the form + /// of key-value pairs. + 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 state = default(string), string haState = default(string), string fullyQualifiedDomainName = default(string), string displayName = default(string), StorageProfile storageProfile = default(StorageProfile), string publicNetworkAccess = default(string), MaintenanceWindow maintenanceWindow = default(MaintenanceWindow), HAEnabledEnum? haEnabled = default(HAEnabledEnum?), string sourceServerName = default(string), System.DateTime? pointInTimeUTC = default(System.DateTime?), string availabilityZone = default(string), string standbyAvailabilityZone = default(string), string byokEnforcement = default(string), ServerPropertiesDelegatedSubnetArguments delegatedSubnetArguments = default(ServerPropertiesDelegatedSubnetArguments), string createMode = default(string), IDictionary serverTags = default(IDictionary)) + : base(location, id, name, type, tags) + { + Identity = identity; + Sku = sku; + AdministratorLogin = administratorLogin; + AdministratorLoginPassword = administratorLoginPassword; + Version = version; + State = state; + HaState = haState; + FullyQualifiedDomainName = fullyQualifiedDomainName; + DisplayName = displayName; + StorageProfile = storageProfile; + PublicNetworkAccess = publicNetworkAccess; + MaintenanceWindow = maintenanceWindow; + HaEnabled = haEnabled; + SourceServerName = sourceServerName; + PointInTimeUTC = pointInTimeUTC; + AvailabilityZone = availabilityZone; + StandbyAvailabilityZone = standbyAvailabilityZone; + ByokEnforcement = byokEnforcement; + DelegatedSubnetArguments = delegatedSubnetArguments; + CreateMode = createMode; + ServerTags = serverTags; + 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 Identity Identity { get; set; } + + /// + /// Gets or sets the SKU (pricing tier) of the server. + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// 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 = "properties.administratorLogin")] + public string AdministratorLogin { get; set; } + + /// + /// 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: + /// '12', '11' + /// + [JsonProperty(PropertyName = "properties.version")] + public string Version { get; set; } + + /// + /// Gets a state of a server that is visible to user. Possible values + /// include: 'Ready', 'Dropping', 'Disabled', 'Starting', 'Stopping', + /// 'Stopped', 'Updating' + /// + [JsonProperty(PropertyName = "properties.state")] + public string State { get; private set; } + + /// + /// Gets a state of a HA server that is visible to user. Possible + /// values include: 'NotEnabled', 'CreatingStandby', 'ReplicatingData', + /// 'FailingOver', 'Healthy', 'RemovingStandby' + /// + [JsonProperty(PropertyName = "properties.haState")] + public string HaState { get; private set; } + + /// + /// Gets the fully qualified domain name of a server. + /// + [JsonProperty(PropertyName = "properties.fullyQualifiedDomainName")] + public string FullyQualifiedDomainName { get; private set; } + + /// + /// Gets or sets the display name of a server. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets storage profile of a server. + /// + [JsonProperty(PropertyName = "properties.storageProfile")] + public StorageProfile StorageProfile { get; set; } + + /// + /// Gets public network access is enabled or not. Possible values + /// include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.publicNetworkAccess")] + public string PublicNetworkAccess { get; private set; } + + /// + /// Gets or sets maintenance window of a server. + /// + [JsonProperty(PropertyName = "properties.maintenanceWindow")] + public MaintenanceWindow MaintenanceWindow { get; set; } + + /// + /// Gets or sets stand by count value can be either enabled or + /// disabled. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.haEnabled")] + public HAEnabledEnum? HaEnabled { get; set; } + + /// + /// Gets or sets the source PostgreSQL server name to restore from. + /// + [JsonProperty(PropertyName = "properties.sourceServerName")] + public string SourceServerName { get; set; } + + /// + /// Gets or sets restore point creation time (ISO8601 format), + /// specifying the time to restore from. + /// + [JsonProperty(PropertyName = "properties.pointInTimeUTC")] + public System.DateTime? PointInTimeUTC { get; set; } + + /// + /// Gets or sets availability Zone information of the server. + /// + [JsonProperty(PropertyName = "properties.availabilityZone")] + public string AvailabilityZone { get; set; } + + /// + /// Gets availability Zone information of the server. + /// + [JsonProperty(PropertyName = "properties.standbyAvailabilityZone")] + public string StandbyAvailabilityZone { get; private set; } + + /// + /// Gets status showing whether the data encryption is enabled with + /// customer-managed keys. + /// + [JsonProperty(PropertyName = "properties.byokEnforcement")] + public string ByokEnforcement { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties.delegatedSubnetArguments")] + public ServerPropertiesDelegatedSubnetArguments DelegatedSubnetArguments { get; set; } + + /// + /// Gets or sets the mode to create a new PostgreSQL server. Possible + /// values include: 'Default', 'PointInTimeRestore' + /// + [JsonProperty(PropertyName = "properties.createMode")] + public string CreateMode { get; set; } + + /// + /// Gets or sets application-specific metadata in the form of key-value + /// pairs. + /// + [JsonProperty(PropertyName = "properties.tags")] + public IDictionary ServerTags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Sku != null) + { + Sku.Validate(); + } + } + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerEditionCapability.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerEditionCapability.cs new file mode 100644 index 0000000000000..ce1b1aca1c468 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/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.FlexibleServers.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/postgresqlflexibleservers/Generated/Models/ServerForUpdate.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerForUpdate.cs new file mode 100644 index 0000000000000..b2b9a53c8d3e5 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerForUpdate.cs @@ -0,0 +1,124 @@ +// +// 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.FlexibleServers.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 profile of a server. + /// stand by count value can be either enabled + /// or disabled. Possible values include: 'Enabled', 'Disabled' + /// Maintenance window of a + /// server. + /// Application-specific metadata in the form of + /// key-value pairs. + public ServerForUpdate(string location = default(string), Sku sku = default(Sku), string administratorLoginPassword = default(string), StorageProfile storageProfile = default(StorageProfile), HAEnabledEnum? haEnabled = default(HAEnabledEnum?), MaintenanceWindow maintenanceWindow = default(MaintenanceWindow), IDictionary tags = default(IDictionary)) + { + Location = location; + Sku = sku; + AdministratorLoginPassword = administratorLoginPassword; + StorageProfile = storageProfile; + HaEnabled = haEnabled; + MaintenanceWindow = maintenanceWindow; + 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 profile of a server. + /// + [JsonProperty(PropertyName = "properties.storageProfile")] + public StorageProfile StorageProfile { get; set; } + + /// + /// Gets or sets stand by count value can be either enabled or + /// disabled. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.haEnabled")] + public HAEnabledEnum? HaEnabled { get; set; } + + /// + /// Gets or sets maintenance window of a server. + /// + [JsonProperty(PropertyName = "properties.maintenanceWindow")] + public MaintenanceWindow MaintenanceWindow { 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/postgresqlflexibleservers/Generated/Models/ServerHAState.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerHAState.cs new file mode 100644 index 0000000000000..37c795ff14990 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerHAState.cs @@ -0,0 +1,26 @@ +// +// 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.FlexibleServers.Models +{ + + /// + /// Defines values for ServerHAState. + /// + public static class ServerHAState + { + 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/postgresqlflexibleservers/Generated/Models/ServerKey.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerKey.cs new file mode 100644 index 0000000000000..c0400e3e62678 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerKey.cs @@ -0,0 +1,91 @@ +// +// 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.FlexibleServers.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/postgresqlflexibleservers/Generated/Models/ServerPropertiesDelegatedSubnetArguments.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerPropertiesDelegatedSubnetArguments.cs new file mode 100644 index 0000000000000..ca4fc4dda3de4 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerPropertiesDelegatedSubnetArguments.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.FlexibleServers.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class ServerPropertiesDelegatedSubnetArguments + { + /// + /// Initializes a new instance of the + /// ServerPropertiesDelegatedSubnetArguments class. + /// + public ServerPropertiesDelegatedSubnetArguments() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ServerPropertiesDelegatedSubnetArguments class. + /// + /// delegated subnet arm resource + /// id. + public ServerPropertiesDelegatedSubnetArguments(string subnetArmResourceId = default(string)) + { + SubnetArmResourceId = subnetArmResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets delegated subnet arm resource id. + /// + [JsonProperty(PropertyName = "subnetArmResourceId")] + public string SubnetArmResourceId { get; set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerPublicNetworkAccessState.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerPublicNetworkAccessState.cs new file mode 100644 index 0000000000000..fa58966274aa1 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerPublicNetworkAccessState.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.FlexibleServers.Models +{ + + /// + /// Defines values for ServerPublicNetworkAccessState. + /// + public static class ServerPublicNetworkAccessState + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerState.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerState.cs new file mode 100644 index 0000000000000..f448e16d4adfd --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerState.cs @@ -0,0 +1,27 @@ +// +// 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.FlexibleServers.Models +{ + + /// + /// Defines values for ServerState. + /// + public static class ServerState + { + public const string Ready = "Ready"; + public const string Dropping = "Dropping"; + public const string Disabled = "Disabled"; + 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/postgresqlflexibleservers/Generated/Models/ServerVersion.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerVersion.cs new file mode 100644 index 0000000000000..a57af0a5de536 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerVersion.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.FlexibleServers.Models +{ + + /// + /// Defines values for ServerVersion. + /// + public static class ServerVersion + { + public const string OneTwo = "12"; + public const string OneOne = "11"; + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerVersionCapability.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/ServerVersionCapability.cs new file mode 100644 index 0000000000000..db1e5947258b6 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/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.FlexibleServers.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/postgresqlflexibleservers/Generated/Models/Sku.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/Sku.cs new file mode 100644 index 0000000000000..ebf6ab0dc8544 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/Sku.cs @@ -0,0 +1,83 @@ +// +// 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.FlexibleServers.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Sku information related properties of a server. + /// + public partial class Sku + { + /// + /// Initializes a new instance of the Sku class. + /// + public Sku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Sku 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 Sku(string name, string tier) + { + Name = name; + Tier = tier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the sku, typically, tier + family + cores, + /// e.g. Standard_D4s_v3. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// 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; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Tier == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Tier"); + } + } + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/SkuTier.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/SkuTier.cs new file mode 100644 index 0000000000000..9f86e03940e63 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/SkuTier.cs @@ -0,0 +1,23 @@ +// +// 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.FlexibleServers.Models +{ + + /// + /// Defines values for SkuTier. + /// + public static class SkuTier + { + 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/postgresqlflexibleservers/Generated/Models/StorageEditionCapability.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/StorageEditionCapability.cs new file mode 100644 index 0000000000000..8af0b09d41dd3 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/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.FlexibleServers.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/postgresqlflexibleservers/Generated/Models/StorageMBCapability.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/StorageMBCapability.cs new file mode 100644 index 0000000000000..ae94f4b9b7b26 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/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.FlexibleServers.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/postgresqlflexibleservers/Generated/Models/StorageProfile.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/StorageProfile.cs new file mode 100644 index 0000000000000..570430829e0a3 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/StorageProfile.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.FlexibleServers.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Storage Profile properties of a server + /// + public partial class StorageProfile + { + /// + /// Initializes a new instance of the StorageProfile class. + /// + public StorageProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StorageProfile class. + /// + /// Backup retention days for the + /// server. + /// Max storage allowed for a server. + public StorageProfile(int? backupRetentionDays = default(int?), int? storageMB = default(int?)) + { + BackupRetentionDays = backupRetentionDays; + StorageMB = storageMB; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets backup retention days for the server. + /// + [JsonProperty(PropertyName = "backupRetentionDays")] + public int? BackupRetentionDays { get; set; } + + /// + /// Gets or sets max storage allowed for a server. + /// + [JsonProperty(PropertyName = "storageMB")] + public int? StorageMB { get; set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/TrackedResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/TrackedResource.cs new file mode 100644 index 0000000000000..9bb338a69a8c6 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/TrackedResource.cs @@ -0,0 +1,83 @@ +// +// 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.FlexibleServers.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The resource model definition for a ARM tracked top level resource + /// + public partial class TrackedResource : Resource + { + /// + /// Initializes a new instance of the TrackedResource class. + /// + public TrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TrackedResource class. + /// + /// The geo-location where the resource + /// lives + /// 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. + /// 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) + { + Tags = tags; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the geo-location where the resource lives + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/VcoreCapability.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/VcoreCapability.cs new file mode 100644 index 0000000000000..3f24898a8b93f --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/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.FlexibleServers.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/postgresqlflexibleservers/Generated/Models/VirtualNetworkSubnetUsageParameter.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/VirtualNetworkSubnetUsageParameter.cs new file mode 100644 index 0000000000000..b1179b9f4a92d --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/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.FlexibleServers.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/postgresqlflexibleservers/Generated/Models/VirtualNetworkSubnetUsageResult.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/VirtualNetworkSubnetUsageResult.cs new file mode 100644 index 0000000000000..7bbf54bae69bb --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Models/VirtualNetworkSubnetUsageResult.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.FlexibleServers.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Virtual network subnet usage data. + /// + public partial class VirtualNetworkSubnetUsageResult + { + /// + /// Initializes a new instance of the VirtualNetworkSubnetUsageResult + /// class. + /// + public VirtualNetworkSubnetUsageResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualNetworkSubnetUsageResult + /// class. + /// + public VirtualNetworkSubnetUsageResult(IList delegatedSubnetsUsage = default(IList)) + { + DelegatedSubnetsUsage = delegatedSubnetsUsage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "delegatedSubnetsUsage")] + public IList DelegatedSubnetsUsage { get; private set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Operations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Operations.cs similarity index 95% rename from sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Operations.cs rename to sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Operations.cs index 495944e1f5b5c..c0b4488f65b71 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Operations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/Operations.cs @@ -8,7 +8,7 @@ // regenerated. // -namespace Microsoft.Azure.Management.PostgreSQL +namespace Microsoft.Azure.Management.PostgreSQL.FlexibleServers { using Microsoft.Rest; using Microsoft.Rest.Azure; @@ -80,6 +80,13 @@ internal Operations(PostgreSQLManagementClient client) { 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; @@ -92,7 +99,7 @@ internal Operations(PostgreSQLManagementClient client) } // 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 (Client.ApiVersion != null) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/OperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/OperationsExtensions.cs new file mode 100644 index 0000000000000..50632d6c0488d --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/OperationsExtensions.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.FlexibleServers +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Lists all of the available REST API operations. + /// + /// + /// The operations group for this extension method. + /// + public static OperationListResult List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/PostgreSQLManagementClient.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/PostgreSQLManagementClient.cs new file mode 100644 index 0000000000000..07cb9a6f8b058 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/PostgreSQLManagementClient.cs @@ -0,0 +1,405 @@ +// +// 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.FlexibleServers +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + + /// + /// The Microsoft Azure management API provides create, read, update, and + /// delete functionality for Azure PostgreSQL resources including servers, + /// databases, firewall rules, VNET rules, security alert policies, log + /// files and configurations with new business model. + /// + public partial class PostgreSQLManagementClient : ServiceClient, IPostgreSQLManagementClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + 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. + /// + public string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IServersOperations. + /// + public virtual IServersOperations Servers { get; private set; } + + /// + /// Gets the IFirewallRulesOperations. + /// + public virtual IFirewallRulesOperations FirewallRules { get; private set; } + + /// + /// Gets the IConfigurationsOperations. + /// + public virtual IConfigurationsOperations Configurations { get; private set; } + + /// + /// Gets the IServerKeysOperations. + /// + public virtual IServerKeysOperations ServerKeys { get; private set; } + + /// + /// Gets the ICheckNameAvailabilityOperations. + /// + public virtual ICheckNameAvailabilityOperations CheckNameAvailability { get; private set; } + + /// + /// Gets the ILocationBasedCapabilitiesOperations. + /// + public virtual ILocationBasedCapabilitiesOperations LocationBasedCapabilities { get; private set; } + + /// + /// Gets the IVirtualNetworkSubnetUsageOperations. + /// + public virtual IVirtualNetworkSubnetUsageOperations VirtualNetworkSubnetUsage { get; private set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Initializes a new instance of the PostgreSQLManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling PostgreSQLManagementClient.Dispose(). False: will not dispose provided httpClient + protected PostgreSQLManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the PostgreSQLManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected PostgreSQLManagementClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the PostgreSQLManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected PostgreSQLManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the PostgreSQLManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected PostgreSQLManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the PostgreSQLManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected PostgreSQLManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the PostgreSQLManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public PostgreSQLManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the PostgreSQLManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling PostgreSQLManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public PostgreSQLManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the PostgreSQLManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public PostgreSQLManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the PostgreSQLManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public PostgreSQLManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the PostgreSQLManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public PostgreSQLManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + Servers = new ServersOperations(this); + FirewallRules = new FirewallRulesOperations(this); + Configurations = new ConfigurationsOperations(this); + ServerKeys = new ServerKeysOperations(this); + CheckNameAvailability = new CheckNameAvailabilityOperations(this); + LocationBasedCapabilities = new LocationBasedCapabilitiesOperations(this); + VirtualNetworkSubnetUsage = new VirtualNetworkSubnetUsageOperations(this); + Operations = new Operations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2020-02-14-privatepreview"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/SdkInfo_PostgreSQLManagementClient.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/SdkInfo_PostgreSQLManagementClient.cs new file mode 100644 index 0000000000000..140bb656c1295 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/SdkInfo_PostgreSQLManagementClient.cs @@ -0,0 +1,34 @@ + +// +// 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.FlexibleServers +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_PostgreSQLManagementClient + { + get + { + return new Tuple[] + { + new Tuple("DBForPostgreSql", "CheckNameAvailability", "2020-02-14-privatepreview"), + new Tuple("DBForPostgreSql", "Configurations", "2020-02-14-privatepreview"), + new Tuple("DBForPostgreSql", "FirewallRules", "2020-02-14-privatepreview"), + new Tuple("DBForPostgreSql", "LocationBasedCapabilities", "2020-02-14-privatepreview"), + new Tuple("DBForPostgreSql", "Operations", "2020-02-14-privatepreview"), + new Tuple("DBForPostgreSql", "ServerKeys", "2020-02-14-privatepreview"), + new Tuple("DBForPostgreSql", "Servers", "2020-02-14-privatepreview"), + new Tuple("DBForPostgreSql", "VirtualNetworkSubnetUsage", "2020-02-14-privatepreview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/ServerKeysOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/ServerKeysOperations.cs new file mode 100644 index 0000000000000..4ebe373d8c7ad --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/ServerKeysOperations.cs @@ -0,0 +1,1220 @@ +// +// 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.FlexibleServers +{ + 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.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, "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/flexibleServers/{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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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.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); + } + } + // 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("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/flexibleServers/{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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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.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\\._\\(\\)]+$"); + } + } + // 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("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/flexibleServers/{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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(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.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\\._\\(\\)]+$"); + } + } + // 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("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/flexibleServers/{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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 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/postgresqlflexibleservers/Generated/ServerKeysOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/ServerKeysOperationsExtensions.cs new file mode 100644 index 0000000000000..17002802b954a --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/ServerKeysOperationsExtensions.cs @@ -0,0 +1,339 @@ +// +// 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.FlexibleServers +{ + 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/postgresqlflexibleservers/Generated/ServersOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/ServersOperations.cs new file mode 100644 index 0000000000000..15b0787a73482 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/ServersOperations.cs @@ -0,0 +1,2489 @@ +// +// 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.FlexibleServers +{ + 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; + + /// + /// ServersOperations operations. + /// + internal partial class ServersOperations : IServiceOperations, IServersOperations + { + /// + /// Initializes a new instance of the ServersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ServersOperations(PostgreSQLManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the PostgreSQLManagementClient + /// + public PostgreSQLManagementClient Client { get; private set; } + + /// + /// Creates a new server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The required parameters for creating or updating a server. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + 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); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an existing server. The request body can contain one to many of the + /// properties present in the normal server definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The required parameters for updating a server. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + 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); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes 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 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); + } + + /// + /// Gets information about 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> 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"); + } + 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, "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/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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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 resource group. + /// + /// + /// 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>> 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"); + } + 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\\._\\(\\)]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + 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/flexibleServers").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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. + /// + /// + /// 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(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); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "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/flexibleServers").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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; + } + + /// + /// Restarts 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)) + { + // Send request + AzureOperationResponse _response = await BeginRestartWithHttpMessagesAsync(resourceGroupName, serverName, 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 StopWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(resourceGroupName, serverName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The required parameters for creating or updating a 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> 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"); + } + 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 (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // 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("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + 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/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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(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; + } + + /// + /// Updates an existing server. The request body can contain one to many of the + /// properties present in the normal server definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The required parameters for updating a 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> 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"); + } + 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 (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + 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/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 (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("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 && (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 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 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"); + } + 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, "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/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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 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; + } + + /// + /// Restarts 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 BeginRestartWithHttpMessagesAsync(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, "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/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 (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; + } + + /// + /// 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/postgresqlflexibleservers/Generated/ServersOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/ServersOperationsExtensions.cs new file mode 100644 index 0000000000000..fa5127c44a55d --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/ServersOperationsExtensions.cs @@ -0,0 +1,679 @@ +// +// 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.FlexibleServers +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ServersOperations. + /// + public static partial class ServersOperationsExtensions + { + /// + /// Creates a new 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 required parameters for creating or updating a server. + /// + 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. + /// + /// + /// 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 a server. + /// + /// + /// The cancellation token. + /// + 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)) + { + return _result.Body; + } + } + + /// + /// Updates an existing server. The request body can contain one to many of the + /// properties present in the normal server definition. + /// + /// + /// 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 updating a server. + /// + public static Server Update(this IServersOperations operations, string resourceGroupName, string serverName, ServerForUpdate parameters) + { + return operations.UpdateAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates an existing server. The request body can contain one to many of the + /// properties present in the normal server definition. + /// + /// + /// 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 updating a server. + /// + /// + /// The cancellation token. + /// + 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)) + { + return _result.Body; + } + } + + /// + /// Deletes 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 Delete(this IServersOperations operations, string resourceGroupName, string serverName) + { + operations.DeleteAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// Deletes 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 DeleteAsync(this IServersOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets information about 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 Server Get(this IServersOperations operations, string resourceGroupName, string serverName) + { + return operations.GetAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about 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 GetAsync(this IServersOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List all the servers in a given resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IPage ListByResourceGroup(this IServersOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// List all the servers in a given resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + 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)) + { + return _result.Body; + } + } + + /// + /// List all the servers in a given subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IServersOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// List all the servers in a given subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IServersOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Restarts 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 Restart(this IServersOperations operations, string resourceGroupName, string serverName) + { + operations.RestartAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// Restarts 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)) + { + (await operations.RestartWithHttpMessagesAsync(resourceGroupName, serverName, 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 StopAsync(this IServersOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StopWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates a new 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 required parameters for creating or updating a server. + /// + 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. + /// + /// + /// 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 a server. + /// + /// + /// The cancellation token. + /// + 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)) + { + return _result.Body; + } + } + + /// + /// Updates an existing server. The request body can contain one to many of the + /// properties present in the normal server definition. + /// + /// + /// 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 updating a server. + /// + public static Server BeginUpdate(this IServersOperations operations, string resourceGroupName, string serverName, ServerForUpdate parameters) + { + return operations.BeginUpdateAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates an existing server. The request body can contain one to many of the + /// properties present in the normal server definition. + /// + /// + /// 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 updating a server. + /// + /// + /// The cancellation token. + /// + 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)) + { + return _result.Body; + } + } + + /// + /// Deletes 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 BeginDelete(this IServersOperations operations, string resourceGroupName, string serverName) + { + operations.BeginDeleteAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// Deletes 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 BeginDeleteAsync(this IServersOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Restarts 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 BeginRestart(this IServersOperations operations, string resourceGroupName, string serverName) + { + operations.BeginRestartAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// Restarts 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 BeginRestartAsync(this IServersOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRestartWithHttpMessagesAsync(resourceGroupName, serverName, 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> ListNextAsync(this IServersOperations 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/postgresqlflexibleservers/Generated/VirtualNetworkSubnetUsageOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/VirtualNetworkSubnetUsageOperations.cs new file mode 100644 index 0000000000000..6c23ed2309788 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/VirtualNetworkSubnetUsageOperations.cs @@ -0,0 +1,269 @@ +// +// 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.FlexibleServers +{ + 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; + + /// + /// VirtualNetworkSubnetUsageOperations operations. + /// + internal partial class VirtualNetworkSubnetUsageOperations : IServiceOperations, IVirtualNetworkSubnetUsageOperations + { + /// + /// Initializes a new instance of the VirtualNetworkSubnetUsageOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualNetworkSubnetUsageOperations(PostgreSQLManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the PostgreSQLManagementClient + /// + public PostgreSQLManagementClient Client { get; private set; } + + /// + /// 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. + /// + /// + /// 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> 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"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("parameters", parameters); + 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/locations/{locationName}/checkVirtualNetworkSubnetUsage").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + 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/postgresqlflexibleservers/Generated/VirtualNetworkSubnetUsageOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/VirtualNetworkSubnetUsageOperationsExtensions.cs new file mode 100644 index 0000000000000..3e9a6588a873f --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresqlflexibleservers/Generated/VirtualNetworkSubnetUsageOperationsExtensions.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.FlexibleServers +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualNetworkSubnetUsageOperations. + /// + public static partial class VirtualNetworkSubnetUsageOperationsExtensions + { + /// + /// Get virtual network subnet usage for a given vNet resource id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the location. + /// + /// + /// The required parameters for creating or updating a server. + /// + public static VirtualNetworkSubnetUsageResult Execute(this IVirtualNetworkSubnetUsageOperations operations, string locationName, VirtualNetworkSubnetUsageParameter parameters) + { + return operations.ExecuteAsync(locationName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Get virtual network subnet usage for a given vNet resource id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the location. + /// + /// + /// The required parameters for creating or updating a server. + /// + /// + /// The cancellation token. + /// + public static async Task ExecuteAsync(this IVirtualNetworkSubnetUsageOperations operations, string locationName, VirtualNetworkSubnetUsageParameter parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ExecuteWithHttpMessagesAsync(locationName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/Helpers/TestConfiguration.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/Helpers/TestConfiguration.cs index 3910ca1410003..ad494c134500b 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/Helpers/TestConfiguration.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/Helpers/TestConfiguration.cs @@ -5,6 +5,6 @@ namespace PostgreSQL.Tests.Helpers { public static class TestConfiguration { - public const string Location = "koreasouth"; + public const string Location = "eastus2"; } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/Helpers/Utilities.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/Helpers/Utilities.cs index 8350197f038d6..83b8a35bea370 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/Helpers/Utilities.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/Helpers/Utilities.cs @@ -10,6 +10,7 @@ using Microsoft.Azure.Test.HttpRecorder; using Microsoft.Rest; using Microsoft.Rest.ClientRuntime.Azure.TestFramework; +using FlexibleServers = Microsoft.Azure.Management.PostgreSQL.FlexibleServers; namespace PostgreSQL.Tests.Helpers { @@ -63,6 +64,23 @@ public static PostgreSQLManagementClient GetPostgreSQLManagementClient(MockConte return dmClient; } + public static FlexibleServers.PostgreSQLManagementClient GetPostgreSQLFlexibleServersManagementClient(MockContext context, RecordedDelegatingHandler handler) + { + FlexibleServers.PostgreSQLManagementClient dmClient; + if (IsTestTenant) + { + dmClient = new FlexibleServers.PostgreSQLManagementClient(new TokenCredentials("xyz"), GetHandler()); + dmClient.SubscriptionId = testSubscription; + dmClient.BaseUri = testUri; + } + else + { + handler.IsPassThrough = true; + dmClient = context.GetServiceClient(handlers: handler); + } + return dmClient; + } + private static HttpClientHandler GetHandler() { return Handler; diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/ScenarioTests/CRUDDBForPostgreSQLFlexibleServerTestBase.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/ScenarioTests/CRUDDBForPostgreSQLFlexibleServerTestBase.cs new file mode 100644 index 0000000000000..1a30a651dd0b4 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/ScenarioTests/CRUDDBForPostgreSQLFlexibleServerTestBase.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. +using PostgreSQL.Tests.Helpers; +using Microsoft.Azure.Management.ResourceManager; +using Microsoft.Azure.Management.ResourceManager.Models; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; +using Microsoft.Azure.Management.PostgreSQL.FlexibleServers; +using FlexibleServersModels = Microsoft.Azure.Management.PostgreSQL.FlexibleServers.Models; + +namespace PostgreSQL.Tests.ScenarioTests +{ + public class CRUDDBForPostgreSQLFlexibleServerTestBase + { + protected static string ResourceGroupName; + protected static string ServerName; + + public CRUDDBForPostgreSQLFlexibleServerTestBase() + { + ResourceGroupName = "pgsdkrg"; + ServerName = "pgsdkflexserver"; + } + + protected FlexibleServersModels.Server CreatePostgreSQLFlexibleServersInstance(MockContext context, + PostgreSQLManagementClient client, + ResourceGroup resourceGroup, + string serverName) + { + return client.Servers.Create( + resourceGroup.Name, + serverName, + new FlexibleServersModels.Server(location: resourceGroup.Location, + sku: new FlexibleServersModels.Sku("Standard_D4s_v3", "GeneralPurpose"), + administratorLogin: "testUser", + administratorLoginPassword: "testPassword1!", + version: "12", + storageProfile: new FlexibleServersModels.StorageProfile(storageMB: 524288))); + } + + protected ResourceGroup CreateResourceGroup(MockContext context, + RecordedDelegatingHandler handler, + string resourceGroupName, + string location) + { + var resourcesClient = + Utilities.GetResourceManagementClient( + context, + handler); + + var resourceGroup = resourcesClient.ResourceGroups.CreateOrUpdate( + resourceGroupName, + new ResourceGroup + { + Location = location + }); + + return resourceGroup; + } + + protected void DeleteResourceGroup(MockContext context, + RecordedDelegatingHandler handler, + string resourceGroupName) + { + var resourcesClient = + Utilities.GetResourceManagementClient( + context, + handler); + + resourcesClient.ResourceGroups.Delete(resourceGroupName); + } + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/ScenarioTests/CRUDDBForPostgreSQLTestsBase.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/ScenarioTests/CRUDDBForPostgreSQLTestsBase.cs index e061bc7bbf3f1..bca69fa7e2df4 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/ScenarioTests/CRUDDBForPostgreSQLTestsBase.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/ScenarioTests/CRUDDBForPostgreSQLTestsBase.cs @@ -16,7 +16,7 @@ public class CRUDPostgreSQLTestsBase : TestBase protected static string ServerName; protected static string DmsProjectName; protected static string DmsTaskName; - + public CRUDPostgreSQLTestsBase() { ResourceGroupName = "pgsdkrg"; diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/ScenarioTests/CRUDFlexibleServersServiceTests.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/ScenarioTests/CRUDFlexibleServersServiceTests.cs new file mode 100644 index 0000000000000..a792015d677c9 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/ScenarioTests/CRUDFlexibleServersServiceTests.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. + +using System.Net; +using PostgreSQL.Tests.Helpers; +using Microsoft.Azure.Management.PostgreSQL.FlexibleServers; +using Microsoft.Azure.Management.PostgreSQL.FlexibleServers.Models; +using Microsoft.Azure.Management.Resources; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; +using Xunit; + +namespace PostgreSQL.Tests.ScenarioTests +{ + public class CRUDFlexibleServersServiceTests : CRUDDBForPostgreSQLFlexibleServerTestBase + { + [Fact] + public void CreateResourceSucceeds() + { + var clientHandler = new RecordedDelegatingHandler() { StatusCodeToReturn = HttpStatusCode.OK }; + var resourcesHandler = new RecordedDelegatingHandler() { StatusCodeToReturn = HttpStatusCode.OK }; + + using (MockContext context = MockContext.Start(this.GetType())) + { + var resourceGroup = CreateResourceGroup(context, resourcesHandler, ResourceGroupName, TestConfiguration.Location); + var client = Utilities.GetPostgreSQLFlexibleServersManagementClient(context, clientHandler); + var createResult = CreatePostgreSQLFlexibleServersInstance(context, client, resourceGroup, ServerName); + } + // Wait for resource group deletion to complete. + Utilities.WaitIfNotInPlaybackMode(); + } + + [Fact] + public void GetResourceSucceeds() + { + var clientHandler = new RecordedDelegatingHandler() { StatusCodeToReturn = HttpStatusCode.OK }; + var resourcesHandler = new RecordedDelegatingHandler() { StatusCodeToReturn = HttpStatusCode.OK }; + + using (MockContext context = MockContext.Start(this.GetType())) + { + var resourceGroup = CreateResourceGroup(context, resourcesHandler, ResourceGroupName, TestConfiguration.Location); + var client = Utilities.GetPostgreSQLFlexibleServersManagementClient(context, clientHandler); + var createResult = CreatePostgreSQLFlexibleServersInstance(context, client, resourceGroup, ServerName); + var getResult = client.Servers.Get(resourceGroup.Name, ServerName); + } + // Wait for resource group deletion to complete. + Utilities.WaitIfNotInPlaybackMode(); + } + + [Fact] + public void DeleteResourceSucceeds() + { + var clientHandler = new RecordedDelegatingHandler() { StatusCodeToReturn = HttpStatusCode.OK }; + var resourcesHandler = new RecordedDelegatingHandler() { StatusCodeToReturn = HttpStatusCode.OK }; + + using (MockContext context = MockContext.Start(this.GetType())) + { + var resourceGroup = CreateResourceGroup(context, resourcesHandler, ResourceGroupName, TestConfiguration.Location); + var client = Utilities.GetPostgreSQLFlexibleServersManagementClient(context, clientHandler); + var createResult = CreatePostgreSQLFlexibleServersInstance(context, client, resourceGroup, ServerName); + var getResult = client.Servers.Get(resourceGroup.Name, ServerName); + client.Servers.Delete(resourceGroup.Name, ServerName); + } + // Wait for resource group deletion to complete. + Utilities.WaitIfNotInPlaybackMode(); + } + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDFlexibleServersServiceTests/CreateResourceSucceeds.json b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDFlexibleServersServiceTests/CreateResourceSucceeds.json new file mode 100644 index 0000000000000..5966c2e3293d3 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDFlexibleServersServiceTests/CreateResourceSucceeds.json @@ -0,0 +1,449 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourcegroups/pgsdkrg?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlZ3JvdXBzL3Bnc2Rrcmc/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"eastus2euap\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "11938ccd-08de-4186-81ec-20e1120a7c59" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "33" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "513a6915-e442-49a3-be04-b52371d512ac" + ], + "x-ms-correlation-request-id": [ + "513a6915-e442-49a3-be04-b52371d512ac" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T181308Z:513a6915-e442-49a3-be04-b52371d512ac" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 18:13:07 GMT" + ], + "Content-Length": [ + "172" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg\",\r\n \"name\": \"pgsdkrg\",\r\n \"location\": \"eastus2euap\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBForPostgreSql/flexibleServers/pgsdkflexserver?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQkZvclBvc3RncmVTcWwvZmxleGlibGVTZXJ2ZXJzL3Bnc2RrZmxleHNlcnZlcj9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"sku\": {\r\n \"name\": \"Standard_D4s_v3\",\r\n \"tier\": \"GeneralPurpose\"\r\n },\r\n \"properties\": {\r\n \"administratorLogin\": \"testUser\",\r\n \"administratorLoginPassword\": \"testPassword1!\",\r\n \"version\": \"12\",\r\n \"storageProfile\": {\r\n \"storageMB\": 524288\r\n }\r\n },\r\n \"location\": \"eastus2euap\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "304a2a94-c47c-42ee-b086-a980d66a7754" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "311" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/operationResults/eea1b92b-4d3d-4664-8689-122b303c7ec3?api-version=2020-02-14-privatepreview" + ], + "Retry-After": [ + "60" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/eea1b92b-4d3d-4664-8689-122b303c7ec3?api-version=2020-02-14-privatepreview" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "eea1b92b-4d3d-4664-8689-122b303c7ec3" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "194e8ca2-4938-470f-9157-bdb60499149b" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T181322Z:194e8ca2-4938-470f-9157-bdb60499149b" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 18:13:21 GMT" + ], + "Content-Length": [ + "88" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"operation\": \"UpsertServerManagementOperationV2\",\r\n \"startTime\": \"2020-09-11T18:13:22.197Z\"\r\n}", + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/eea1b92b-4d3d-4664-8689-122b303c7ec3?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uL2VlYTFiOTJiLTRkM2QtNDY2NC04Njg5LTEyMmIzMDNjN2VjMz9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "60" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "a46b02d3-98b6-44b2-99c1-70a3d934d894" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "ad47f3b8-bb4e-4e7a-8636-6d1825d8ac0c" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T181423Z:ad47f3b8-bb4e-4e7a-8636-6d1825d8ac0c" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 18:14:22 GMT" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"eea1b92b-4d3d-4664-8689-122b303c7ec3\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-09-11T18:13:22.197Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/eea1b92b-4d3d-4664-8689-122b303c7ec3?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uL2VlYTFiOTJiLTRkM2QtNDY2NC04Njg5LTEyMmIzMDNjN2VjMz9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "60" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "73843b4a-d22f-493f-941c-544433c1237b" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11998" + ], + "x-ms-correlation-request-id": [ + "0f62d650-3580-4359-afd6-0af9061434d6" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T181524Z:0f62d650-3580-4359-afd6-0af9061434d6" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 18:15:24 GMT" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"eea1b92b-4d3d-4664-8689-122b303c7ec3\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-09-11T18:13:22.197Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/eea1b92b-4d3d-4664-8689-122b303c7ec3?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uL2VlYTFiOTJiLTRkM2QtNDY2NC04Njg5LTEyMmIzMDNjN2VjMz9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "60" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "a7318e55-48b5-4928-a538-428a9008211a" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11997" + ], + "x-ms-correlation-request-id": [ + "8ef09d92-50d9-4a9c-a825-83d541e65240" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T181625Z:8ef09d92-50d9-4a9c-a825-83d541e65240" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 18:16:25 GMT" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"eea1b92b-4d3d-4664-8689-122b303c7ec3\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-09-11T18:13:22.197Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/eea1b92b-4d3d-4664-8689-122b303c7ec3?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uL2VlYTFiOTJiLTRkM2QtNDY2NC04Njg5LTEyMmIzMDNjN2VjMz9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "60" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "3c730013-6687-443d-bbb3-ab7e11c66a69" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11996" + ], + "x-ms-correlation-request-id": [ + "67af0ef2-715a-4878-a6c9-add7d91a8a7d" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T181726Z:67af0ef2-715a-4878-a6c9-add7d91a8a7d" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 18:17:25 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"eea1b92b-4d3d-4664-8689-122b303c7ec3\",\r\n \"status\": \"Succeeded\",\r\n \"startTime\": \"2020-09-11T18:13:22.197Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBForPostgreSql/flexibleServers/pgsdkflexserver?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQkZvclBvc3RncmVTcWwvZmxleGlibGVTZXJ2ZXJzL3Bnc2RrZmxleHNlcnZlcj9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "f614228a-1a89-4267-98b1-083185d139cb" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11995" + ], + "x-ms-correlation-request-id": [ + "0ad6e091-ff66-46f5-a669-fe99dae11478" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T181726Z:0ad6e091-ff66-46f5-a669-fe99dae11478" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 18:17:26 GMT" + ], + "Content-Length": [ + "873" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"Standard_D4s_v3\",\r\n \"tier\": \"GeneralPurpose\",\r\n \"capacity\": 4\r\n },\r\n \"properties\": {\r\n \"fullyQualifiedDomainName\": \"pgsdkflexserver.postgres.database.azure.com\",\r\n \"version\": \"12\",\r\n \"standbyCount\": 0,\r\n \"haEnabled\": \"Disabled\",\r\n \"administratorLogin\": \"testUser\",\r\n \"publicNetworkAccess\": \"Disabled\",\r\n \"logBackupStorageSku\": \"Standard_ZRS\",\r\n \"haState\": \"NotEnabled\",\r\n \"state\": \"Ready\",\r\n \"availabilityZone\": \"1\",\r\n \"storageProfile\": {\r\n \"storageMB\": 524288,\r\n \"backupRetentionDays\": 7\r\n },\r\n \"earliestRestoreDate\": \"2020-09-11T21:17:26.8359535+03:00\",\r\n \"byokEnforcement\": \"Disabled\",\r\n \"maintenanceWindow\": {\r\n \"customWindow\": \"Disabled\",\r\n \"dayOfWeek\": 0,\r\n \"startHour\": 0,\r\n \"startMinute\": 0\r\n }\r\n },\r\n \"location\": \"East US 2 EUAP\",\r\n \"id\": \"/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgsdkflexserver\",\r\n \"name\": \"pgsdkflexserver\",\r\n \"type\": \"Microsoft.DBforPostgreSQL/flexibleServers\"\r\n}", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "7fec3109-5b78-4a24-b834-5d47d63e2596" + } +} \ No newline at end of file diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDFlexibleServersServiceTests/DeleteResourceSucceeds.json b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDFlexibleServersServiceTests/DeleteResourceSucceeds.json new file mode 100644 index 0000000000000..d3dcd95413426 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDFlexibleServersServiceTests/DeleteResourceSucceeds.json @@ -0,0 +1,818 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourcegroups/pgsdkrg?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlZ3JvdXBzL3Bnc2Rrcmc/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"eastus2euap\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "1c99e7a7-d45c-46f6-9b0a-572e8601439f" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "33" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "37888941-8fe0-4624-b01a-97431c5c8c9c" + ], + "x-ms-correlation-request-id": [ + "37888941-8fe0-4624-b01a-97431c5c8c9c" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T180241Z:37888941-8fe0-4624-b01a-97431c5c8c9c" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 18:02:40 GMT" + ], + "Content-Length": [ + "172" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg\",\r\n \"name\": \"pgsdkrg\",\r\n \"location\": \"eastus2euap\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBForPostgreSql/flexibleServers/pgsdkflexserver?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQkZvclBvc3RncmVTcWwvZmxleGlibGVTZXJ2ZXJzL3Bnc2RrZmxleHNlcnZlcj9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"sku\": {\r\n \"name\": \"Standard_D4s_v3\",\r\n \"tier\": \"GeneralPurpose\"\r\n },\r\n \"properties\": {\r\n \"administratorLogin\": \"testUser\",\r\n \"administratorLoginPassword\": \"testPassword1!\",\r\n \"version\": \"12\",\r\n \"storageProfile\": {\r\n \"storageMB\": 524288\r\n }\r\n },\r\n \"location\": \"eastus2euap\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "27b9bb6f-505d-470d-b45f-22b6e0eedffb" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "311" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/operationResults/ff403490-8582-463c-b94d-8e2b50c81d0a?api-version=2020-02-14-privatepreview" + ], + "Retry-After": [ + "60" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/ff403490-8582-463c-b94d-8e2b50c81d0a?api-version=2020-02-14-privatepreview" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "ff403490-8582-463c-b94d-8e2b50c81d0a" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "9437b6f8-65a6-4b63-b688-b00ca2311be8" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T180255Z:9437b6f8-65a6-4b63-b688-b00ca2311be8" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 18:02:54 GMT" + ], + "Content-Length": [ + "88" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"operation\": \"UpsertServerManagementOperationV2\",\r\n \"startTime\": \"2020-09-11T18:02:54.873Z\"\r\n}", + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/ff403490-8582-463c-b94d-8e2b50c81d0a?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uL2ZmNDAzNDkwLTg1ODItNDYzYy1iOTRkLThlMmI1MGM4MWQwYT9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "60" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "67bee6b0-95e6-4689-b727-2c821abef381" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "eb5a4260-09d3-4db9-9ff6-42386fba9d9e" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T180356Z:eb5a4260-09d3-4db9-9ff6-42386fba9d9e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 18:03:55 GMT" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"ff403490-8582-463c-b94d-8e2b50c81d0a\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-09-11T18:02:54.873Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/ff403490-8582-463c-b94d-8e2b50c81d0a?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uL2ZmNDAzNDkwLTg1ODItNDYzYy1iOTRkLThlMmI1MGM4MWQwYT9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "60" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "3ae14057-4307-430c-a282-de6ee9bc69bd" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11998" + ], + "x-ms-correlation-request-id": [ + "dfc48e18-829d-414f-b6cf-9affafb58bdd" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T180457Z:dfc48e18-829d-414f-b6cf-9affafb58bdd" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 18:04:56 GMT" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"ff403490-8582-463c-b94d-8e2b50c81d0a\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-09-11T18:02:54.873Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/ff403490-8582-463c-b94d-8e2b50c81d0a?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uL2ZmNDAzNDkwLTg1ODItNDYzYy1iOTRkLThlMmI1MGM4MWQwYT9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "60" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "1f7de40b-999c-4bfe-8bd9-50a685140d7d" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11997" + ], + "x-ms-correlation-request-id": [ + "776d6042-8434-489a-bdbd-beb4697d51e8" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T180558Z:776d6042-8434-489a-bdbd-beb4697d51e8" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 18:05:57 GMT" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"ff403490-8582-463c-b94d-8e2b50c81d0a\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-09-11T18:02:54.873Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/ff403490-8582-463c-b94d-8e2b50c81d0a?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uL2ZmNDAzNDkwLTg1ODItNDYzYy1iOTRkLThlMmI1MGM4MWQwYT9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "60" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "447789ed-a2b6-42c5-b933-88619ebb5899" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11996" + ], + "x-ms-correlation-request-id": [ + "4db6c457-9c35-44bf-87c6-1333ad2c1d93" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T180659Z:4db6c457-9c35-44bf-87c6-1333ad2c1d93" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 18:06:59 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"ff403490-8582-463c-b94d-8e2b50c81d0a\",\r\n \"status\": \"Succeeded\",\r\n \"startTime\": \"2020-09-11T18:02:54.873Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBForPostgreSql/flexibleServers/pgsdkflexserver?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQkZvclBvc3RncmVTcWwvZmxleGlibGVTZXJ2ZXJzL3Bnc2RrZmxleHNlcnZlcj9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "9b73dbe1-33ad-486c-87f3-7609d2c46bea" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11995" + ], + "x-ms-correlation-request-id": [ + "ee13bc48-f1b3-42dc-abc2-5b9ba8558bb8" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T180659Z:ee13bc48-f1b3-42dc-abc2-5b9ba8558bb8" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 18:06:59 GMT" + ], + "Content-Length": [ + "873" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"Standard_D4s_v3\",\r\n \"tier\": \"GeneralPurpose\",\r\n \"capacity\": 4\r\n },\r\n \"properties\": {\r\n \"fullyQualifiedDomainName\": \"pgsdkflexserver.postgres.database.azure.com\",\r\n \"version\": \"12\",\r\n \"standbyCount\": 0,\r\n \"haEnabled\": \"Disabled\",\r\n \"administratorLogin\": \"testUser\",\r\n \"publicNetworkAccess\": \"Disabled\",\r\n \"logBackupStorageSku\": \"Standard_ZRS\",\r\n \"haState\": \"NotEnabled\",\r\n \"state\": \"Ready\",\r\n \"availabilityZone\": \"1\",\r\n \"storageProfile\": {\r\n \"storageMB\": 524288,\r\n \"backupRetentionDays\": 7\r\n },\r\n \"earliestRestoreDate\": \"2020-09-11T21:06:59.6972107+03:00\",\r\n \"byokEnforcement\": \"Disabled\",\r\n \"maintenanceWindow\": {\r\n \"customWindow\": \"Disabled\",\r\n \"dayOfWeek\": 0,\r\n \"startHour\": 0,\r\n \"startMinute\": 0\r\n }\r\n },\r\n \"location\": \"East US 2 EUAP\",\r\n \"id\": \"/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgsdkflexserver\",\r\n \"name\": \"pgsdkflexserver\",\r\n \"type\": \"Microsoft.DBforPostgreSQL/flexibleServers\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBForPostgreSql/flexibleServers/pgsdkflexserver?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQkZvclBvc3RncmVTcWwvZmxleGlibGVTZXJ2ZXJzL3Bnc2RrZmxleHNlcnZlcj9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "6ad39a87-5dd7-43f1-ae8f-bc96b57c0582" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "60fd93c6-8e60-450e-afef-3d5ce5f96934" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11994" + ], + "x-ms-correlation-request-id": [ + "94123697-5bd2-49d3-92f5-80a3f1729b28" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T180700Z:94123697-5bd2-49d3-92f5-80a3f1729b28" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 18:07:00 GMT" + ], + "Content-Length": [ + "873" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"Standard_D4s_v3\",\r\n \"tier\": \"GeneralPurpose\",\r\n \"capacity\": 4\r\n },\r\n \"properties\": {\r\n \"fullyQualifiedDomainName\": \"pgsdkflexserver.postgres.database.azure.com\",\r\n \"version\": \"12\",\r\n \"standbyCount\": 0,\r\n \"haEnabled\": \"Disabled\",\r\n \"administratorLogin\": \"testUser\",\r\n \"publicNetworkAccess\": \"Disabled\",\r\n \"logBackupStorageSku\": \"Standard_ZRS\",\r\n \"haState\": \"NotEnabled\",\r\n \"state\": \"Ready\",\r\n \"availabilityZone\": \"1\",\r\n \"storageProfile\": {\r\n \"storageMB\": 524288,\r\n \"backupRetentionDays\": 7\r\n },\r\n \"earliestRestoreDate\": \"2020-09-11T21:07:00.2121973+03:00\",\r\n \"byokEnforcement\": \"Disabled\",\r\n \"maintenanceWindow\": {\r\n \"customWindow\": \"Disabled\",\r\n \"dayOfWeek\": 0,\r\n \"startHour\": 0,\r\n \"startMinute\": 0\r\n }\r\n },\r\n \"location\": \"East US 2 EUAP\",\r\n \"id\": \"/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgsdkflexserver\",\r\n \"name\": \"pgsdkflexserver\",\r\n \"type\": \"Microsoft.DBforPostgreSQL/flexibleServers\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBForPostgreSql/flexibleServers/pgsdkflexserver?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQkZvclBvc3RncmVTcWwvZmxleGlibGVTZXJ2ZXJzL3Bnc2RrZmxleHNlcnZlcj9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "78cb3461-6060-4805-83bf-28f4083d2620" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/East%20US%202%20EUAP/operationResults/cd3116c3-f640-48be-bc56-5d19eb554d95?api-version=2020-02-14-privatepreview" + ], + "Retry-After": [ + "15" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/East%20US%202%20EUAP/azureAsyncOperation/cd3116c3-f640-48be-bc56-5d19eb554d95?api-version=2020-02-14-privatepreview" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "cd3116c3-f640-48be-bc56-5d19eb554d95" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14999" + ], + "x-ms-correlation-request-id": [ + "7b82b1b7-01d2-41d7-9a58-9c69ea557c91" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T180701Z:7b82b1b7-01d2-41d7-9a58-9c69ea557c91" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 18:07:01 GMT" + ], + "Content-Length": [ + "84" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"operation\": \"DropServerManagementOperation\",\r\n \"startTime\": \"2020-09-11T18:07:01.783Z\"\r\n}", + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/East%20US%202%20EUAP/azureAsyncOperation/cd3116c3-f640-48be-bc56-5d19eb554d95?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9FYXN0JTIwVVMlMjAyJTIwRVVBUC9henVyZUFzeW5jT3BlcmF0aW9uL2NkMzExNmMzLWY2NDAtNDhiZS1iYzU2LTVkMTllYjU1NGQ5NT9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "e1a8f095-f9f6-4973-b7cc-1a110a5e9c67" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11993" + ], + "x-ms-correlation-request-id": [ + "ef84e4fc-8535-41c1-8ccb-fe88487c98cf" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T180717Z:ef84e4fc-8535-41c1-8ccb-fe88487c98cf" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 18:07:17 GMT" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"cd3116c3-f640-48be-bc56-5d19eb554d95\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-09-11T18:07:01.783Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/East%20US%202%20EUAP/azureAsyncOperation/cd3116c3-f640-48be-bc56-5d19eb554d95?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9FYXN0JTIwVVMlMjAyJTIwRVVBUC9henVyZUFzeW5jT3BlcmF0aW9uL2NkMzExNmMzLWY2NDAtNDhiZS1iYzU2LTVkMTllYjU1NGQ5NT9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "f2486bb5-a52e-48d5-b934-83bcf98b6785" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11992" + ], + "x-ms-correlation-request-id": [ + "e2da93dd-8067-401c-a3e4-533310c5a564" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T180732Z:e2da93dd-8067-401c-a3e4-533310c5a564" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 18:07:32 GMT" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"cd3116c3-f640-48be-bc56-5d19eb554d95\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-09-11T18:07:01.783Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/East%20US%202%20EUAP/azureAsyncOperation/cd3116c3-f640-48be-bc56-5d19eb554d95?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9FYXN0JTIwVVMlMjAyJTIwRVVBUC9henVyZUFzeW5jT3BlcmF0aW9uL2NkMzExNmMzLWY2NDAtNDhiZS1iYzU2LTVkMTllYjU1NGQ5NT9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "b88d7b4a-6705-46dc-aa46-e3bf61f675e5" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11991" + ], + "x-ms-correlation-request-id": [ + "7270099d-0785-4c70-b205-76d9515b8b4e" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T180748Z:7270099d-0785-4c70-b205-76d9515b8b4e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 18:07:47 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"cd3116c3-f640-48be-bc56-5d19eb554d95\",\r\n \"status\": \"Succeeded\",\r\n \"startTime\": \"2020-09-11T18:07:01.783Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/East%20US%202%20EUAP/operationResults/cd3116c3-f640-48be-bc56-5d19eb554d95?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9FYXN0JTIwVVMlMjAyJTIwRVVBUC9vcGVyYXRpb25SZXN1bHRzL2NkMzExNmMzLWY2NDAtNDhiZS1iYzU2LTVkMTllYjU1NGQ5NT9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "78f874d9-cbd0-45b3-b712-0b51a36727f2" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11990" + ], + "x-ms-correlation-request-id": [ + "01359365-a489-445a-8643-776532f2ee8f" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T180748Z:01359365-a489-445a-8643-776532f2ee8f" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 18:07:47 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" + ] + }, + "ResponseBody": "", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "7fec3109-5b78-4a24-b834-5d47d63e2596" + } +} \ No newline at end of file diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDFlexibleServersServiceTests/GetResourceSucceeds.json b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDFlexibleServersServiceTests/GetResourceSucceeds.json new file mode 100644 index 0000000000000..c8bb685edb05b --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDFlexibleServersServiceTests/GetResourceSucceeds.json @@ -0,0 +1,512 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourcegroups/pgsdkrg?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlZ3JvdXBzL3Bnc2Rrcmc/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"eastus2euap\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "eb8f3dd7-7068-4e54-8b00-91d28f3bdbfa" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "33" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "f40d4398-61d8-4ee5-9e6a-d954f9ca89a3" + ], + "x-ms-correlation-request-id": [ + "f40d4398-61d8-4ee5-9e6a-d954f9ca89a3" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T175311Z:f40d4398-61d8-4ee5-9e6a-d954f9ca89a3" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:53:11 GMT" + ], + "Content-Length": [ + "172" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg\",\r\n \"name\": \"pgsdkrg\",\r\n \"location\": \"eastus2euap\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBForPostgreSql/flexibleServers/pgsdkflexserver?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQkZvclBvc3RncmVTcWwvZmxleGlibGVTZXJ2ZXJzL3Bnc2RrZmxleHNlcnZlcj9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"sku\": {\r\n \"name\": \"Standard_D4s_v3\",\r\n \"tier\": \"GeneralPurpose\"\r\n },\r\n \"properties\": {\r\n \"administratorLogin\": \"testUser\",\r\n \"administratorLoginPassword\": \"testPassword1!\",\r\n \"version\": \"12\",\r\n \"storageProfile\": {\r\n \"storageMB\": 524288\r\n }\r\n },\r\n \"location\": \"eastus2euap\"\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "7df19bf3-61bc-4986-8961-a0bb8f8f9e40" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "311" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "https://management.azure.com/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/operationResults/aecc4130-810a-42d5-91bb-46e1f3899b24?api-version=2020-02-14-privatepreview" + ], + "Retry-After": [ + "60" + ], + "Azure-AsyncOperation": [ + "https://management.azure.com/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/aecc4130-810a-42d5-91bb-46e1f3899b24?api-version=2020-02-14-privatepreview" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "aecc4130-810a-42d5-91bb-46e1f3899b24" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "3a16e4ad-2059-46b7-924a-3794b5e6cb32" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T175323Z:3a16e4ad-2059-46b7-924a-3794b5e6cb32" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 17:53:23 GMT" + ], + "Content-Length": [ + "88" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"operation\": \"UpsertServerManagementOperationV2\",\r\n \"startTime\": \"2020-09-11T17:53:23.697Z\"\r\n}", + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/aecc4130-810a-42d5-91bb-46e1f3899b24?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uL2FlY2M0MTMwLTgxMGEtNDJkNS05MWJiLTQ2ZTFmMzg5OWIyND9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "60" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "e25e7b3c-009b-48a0-9ff9-b833a274b962" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11999" + ], + "x-ms-correlation-request-id": [ + "17b5d9f3-afd2-4b85-a95f-b59ab5188ca0" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T175424Z:17b5d9f3-afd2-4b85-a95f-b59ab5188ca0" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 17:54:24 GMT" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"aecc4130-810a-42d5-91bb-46e1f3899b24\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-09-11T17:53:23.697Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/aecc4130-810a-42d5-91bb-46e1f3899b24?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uL2FlY2M0MTMwLTgxMGEtNDJkNS05MWJiLTQ2ZTFmMzg5OWIyND9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "60" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "94faa352-79ec-4795-b91f-ea49d3529c34" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11998" + ], + "x-ms-correlation-request-id": [ + "222cf07f-f004-4835-ad3b-6cc1f46a50b5" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T175526Z:222cf07f-f004-4835-ad3b-6cc1f46a50b5" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 17:55:25 GMT" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"aecc4130-810a-42d5-91bb-46e1f3899b24\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-09-11T17:53:23.697Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/aecc4130-810a-42d5-91bb-46e1f3899b24?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uL2FlY2M0MTMwLTgxMGEtNDJkNS05MWJiLTQ2ZTFmMzg5OWIyND9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "60" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "5e6644bb-bb7d-451f-9c74-6a0d3193a14c" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11997" + ], + "x-ms-correlation-request-id": [ + "5b17db16-b527-4b6a-a2dc-cae1280e19d3" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T175627Z:5b17db16-b527-4b6a-a2dc-cae1280e19d3" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 17:56:26 GMT" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"aecc4130-810a-42d5-91bb-46e1f3899b24\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-09-11T17:53:23.697Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/aecc4130-810a-42d5-91bb-46e1f3899b24?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uL2FlY2M0MTMwLTgxMGEtNDJkNS05MWJiLTQ2ZTFmMzg5OWIyND9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "60" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "f1ef0941-b974-4c32-9fed-1d8845032209" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11996" + ], + "x-ms-correlation-request-id": [ + "f3b11bb9-832b-447c-9caf-cc58d8efb0e5" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T175728Z:f3b11bb9-832b-447c-9caf-cc58d8efb0e5" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 17:57:27 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"name\": \"aecc4130-810a-42d5-91bb-46e1f3899b24\",\r\n \"status\": \"Succeeded\",\r\n \"startTime\": \"2020-09-11T17:53:23.697Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBForPostgreSql/flexibleServers/pgsdkflexserver?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQkZvclBvc3RncmVTcWwvZmxleGlibGVTZXJ2ZXJzL3Bnc2RrZmxleHNlcnZlcj9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "f6781ea0-57f9-4682-bbbd-42d010d699ff" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11995" + ], + "x-ms-correlation-request-id": [ + "f83cd61e-7203-4d46-8bba-d901244a6238" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T175728Z:f83cd61e-7203-4d46-8bba-d901244a6238" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 17:57:28 GMT" + ], + "Content-Length": [ + "873" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"Standard_D4s_v3\",\r\n \"tier\": \"GeneralPurpose\",\r\n \"capacity\": 4\r\n },\r\n \"properties\": {\r\n \"fullyQualifiedDomainName\": \"pgsdkflexserver.postgres.database.azure.com\",\r\n \"version\": \"12\",\r\n \"standbyCount\": 0,\r\n \"haEnabled\": \"Disabled\",\r\n \"administratorLogin\": \"testUser\",\r\n \"publicNetworkAccess\": \"Disabled\",\r\n \"logBackupStorageSku\": \"Standard_ZRS\",\r\n \"haState\": \"NotEnabled\",\r\n \"state\": \"Ready\",\r\n \"availabilityZone\": \"1\",\r\n \"storageProfile\": {\r\n \"storageMB\": 524288,\r\n \"backupRetentionDays\": 7\r\n },\r\n \"earliestRestoreDate\": \"2020-09-11T20:57:28.7724491+03:00\",\r\n \"byokEnforcement\": \"Disabled\",\r\n \"maintenanceWindow\": {\r\n \"customWindow\": \"Disabled\",\r\n \"dayOfWeek\": 0,\r\n \"startHour\": 0,\r\n \"startMinute\": 0\r\n }\r\n },\r\n \"location\": \"East US 2 EUAP\",\r\n \"id\": \"/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgsdkflexserver\",\r\n \"name\": \"pgsdkflexserver\",\r\n \"type\": \"Microsoft.DBforPostgreSQL/flexibleServers\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBForPostgreSql/flexibleServers/pgsdkflexserver?api-version=2020-02-14-privatepreview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQkZvclBvc3RncmVTcWwvZmxleGlibGVTZXJ2ZXJzL3Bnc2RrZmxleHNlcnZlcj9hcGktdmVyc2lvbj0yMDIwLTAyLTE0LXByaXZhdGVwcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "b2e61b98-293b-486e-96f9-60dc438ef64d" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.FlexibleServers.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "a218ba71-80bc-4402-91e4-a6869eaf1c63" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11994" + ], + "x-ms-correlation-request-id": [ + "e242091e-21b8-44cf-b280-3b1ada937ea6" + ], + "x-ms-routing-request-id": [ + "UAECENTRAL:20200911T175729Z:e242091e-21b8-44cf-b280-3b1ada937ea6" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Date": [ + "Fri, 11 Sep 2020 17:57:29 GMT" + ], + "Content-Length": [ + "873" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"Standard_D4s_v3\",\r\n \"tier\": \"GeneralPurpose\",\r\n \"capacity\": 4\r\n },\r\n \"properties\": {\r\n \"fullyQualifiedDomainName\": \"pgsdkflexserver.postgres.database.azure.com\",\r\n \"version\": \"12\",\r\n \"standbyCount\": 0,\r\n \"haEnabled\": \"Disabled\",\r\n \"administratorLogin\": \"testUser\",\r\n \"publicNetworkAccess\": \"Disabled\",\r\n \"logBackupStorageSku\": \"Standard_ZRS\",\r\n \"haState\": \"NotEnabled\",\r\n \"state\": \"Ready\",\r\n \"availabilityZone\": \"1\",\r\n \"storageProfile\": {\r\n \"storageMB\": 524288,\r\n \"backupRetentionDays\": 7\r\n },\r\n \"earliestRestoreDate\": \"2020-09-11T20:57:29.3974828+03:00\",\r\n \"byokEnforcement\": \"Disabled\",\r\n \"maintenanceWindow\": {\r\n \"customWindow\": \"Disabled\",\r\n \"dayOfWeek\": 0,\r\n \"startHour\": 0,\r\n \"startMinute\": 0\r\n }\r\n },\r\n \"location\": \"East US 2 EUAP\",\r\n \"id\": \"/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgsdkflexserver\",\r\n \"name\": \"pgsdkflexserver\",\r\n \"type\": \"Microsoft.DBforPostgreSQL/flexibleServers\"\r\n}", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "7fec3109-5b78-4a24-b834-5d47d63e2596" + } +} \ No newline at end of file diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDServiceTests/CreateResourceSucceeds.json b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDServiceTests/CreateResourceSucceeds.json index ce89791d8db6d..a74ece8cd2e46 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDServiceTests/CreateResourceSucceeds.json +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDServiceTests/CreateResourceSucceeds.json @@ -1,45 +1,34 @@ { "Entries": [ { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourcegroups/pgsdkrg?api-version=2017-05-10", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Jlc291cmNlZ3JvdXBzL3Bnc2Rrcmc/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourcegroups/pgsdkrg?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlZ3JvdXBzL3Bnc2Rrcmc/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", "RequestMethod": "PUT", - "RequestBody": "{\r\n \"location\": \"koreasouth\"\r\n}", + "RequestBody": "{\r\n \"location\": \"eastus2euap\"\r\n}", "RequestHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Content-Length": [ - "32" - ], "x-ms-client-request-id": [ - "aa5ae30b-eee8-47f8-964e-bda39afc7ec9" + "ef8998d9-6fbc-43a9-9ddd-58ae254d7216" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.25211.01", + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" - ] - }, - "ResponseBody": "{\r\n \"id\": \"/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourceGroups/pgsdkrg\",\r\n \"name\": \"pgsdkrg\",\r\n \"location\": \"koreasouth\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", - "ResponseHeaders": { - "Content-Length": [ - "171" ], "Content-Type": [ "application/json; charset=utf-8" ], - "Expires": [ - "-1" - ], + "Content-Length": [ + "33" + ] + }, + "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 19:48:59 GMT" - ], "Pragma": [ "no-cache" ], @@ -47,282 +36,354 @@ "1199" ], "x-ms-request-id": [ - "8103e996-d347-45a4-83af-4c4764993fcf" + "12fb19d5-5e5c-4403-85f5-477f1892082d" ], "x-ms-correlation-request-id": [ - "8103e996-d347-45a4-83af-4c4764993fcf" + "12fb19d5-5e5c-4403-85f5-477f1892082d" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T194900Z:8103e996-d347-45a4-83af-4c4764993fcf" + "GERMANYWESTCENTRAL:20200911T172934Z:12fb19d5-5e5c-4403-85f5-477f1892082d" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:29:33 GMT" + ], + "Content-Length": [ + "172" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" ] }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg\",\r\n \"name\": \"pgsdkrg\",\r\n \"location\": \"eastus2euap\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", "StatusCode": 201 }, { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/servers/pgsdkserver?api-version=2017-12-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQmZvclBvc3RncmVTUUwvc2VydmVycy9wZ3Nka3NlcnZlcj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBForPostgreSQL/servers/pgsdkserver?api-version=2017-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQkZvclBvc3RncmVTUUwvc2VydmVycy9wZ3Nka3NlcnZlcj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", "RequestMethod": "PUT", - "RequestBody": "{\r\n \"sku\": {\r\n \"name\": \"B_Gen5_1\"\r\n },\r\n \"properties\": {\r\n \"createMode\": \"Default\",\r\n \"administratorLogin\": \"testUser\",\r\n \"administratorLoginPassword\": \"testPassword1!\"\r\n },\r\n \"location\": \"koreasouth\"\r\n}", + "RequestBody": "{\r\n \"sku\": {\r\n \"name\": \"B_Gen5_1\"\r\n },\r\n \"properties\": {\r\n \"createMode\": \"Default\",\r\n \"administratorLogin\": \"testUser\",\r\n \"administratorLoginPassword\": \"testPassword1!\"\r\n },\r\n \"location\": \"eastus2euap\"\r\n}", "RequestHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Content-Length": [ - "220" - ], "x-ms-client-request-id": [ - "33301890-5650-4b45-adf1-73f2ed0cb2c7" + "75b8f24b-cecb-4ea2-8ecd-c6005e7e29c0" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.25211.01", - "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.0.0" - ] - }, - "ResponseBody": "{\r\n \"operation\": \"UpsertElasticServer\",\r\n \"startTime\": \"2018-03-29T19:49:06.4Z\"\r\n}", - "ResponseHeaders": { - "Content-Length": [ - "72" + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.5" ], "Content-Type": [ "application/json; charset=utf-8" ], - "Expires": [ - "-1" - ], + "Content-Length": [ + "221" + ] + }, + "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 19:49:06 GMT" - ], "Pragma": [ "no-cache" ], "Location": [ - "https://management.azure.com/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/providers/Microsoft.DBforPostgreSQL/locations/koreasouth/operationResults/57339486-7717-4368-aa03-e42f53d43995?api-version=2017-12-01" + "https://management.azure.com/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/operationResults/e87e4845-738b-4423-9f86-92f103f0dd4f?api-version=2017-12-01" ], "Retry-After": [ "60" ], - "Server": [ - "Microsoft-HTTPAPI/2.0" - ], "Azure-AsyncOperation": [ - "https://management.azure.com/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/providers/Microsoft.DBforPostgreSQL/locations/koreasouth/azureAsyncOperation/57339486-7717-4368-aa03-e42f53d43995?api-version=2017-12-01" + "https://management.azure.com/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/e87e4845-738b-4423-9f86-92f103f0dd4f?api-version=2017-12-01" ], "x-ms-request-id": [ - "57339486-7717-4368-aa03-e42f53d43995" + "e87e4845-738b-4423-9f86-92f103f0dd4f" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], "x-ms-correlation-request-id": [ - "4b1b3a81-69ab-452a-9ff6-433f994669bb" + "cc3e0843-a147-4fcf-80f3-7849f935995b" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T194907Z:4b1b3a81-69ab-452a-9ff6-433f994669bb" + "GERMANYWESTCENTRAL:20200911T172941Z:cc3e0843-a147-4fcf-80f3-7849f935995b" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:29:40 GMT" + ], + "Content-Length": [ + "74" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" ] }, + "ResponseBody": "{\r\n \"operation\": \"UpsertElasticServer\",\r\n \"startTime\": \"2020-09-11T17:29:40.253Z\"\r\n}", "StatusCode": 202 }, { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/providers/Microsoft.DBforPostgreSQL/locations/koreasouth/azureAsyncOperation/57339486-7717-4368-aa03-e42f53d43995?api-version=2017-12-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9rb3JlYXNvdXRoL2F6dXJlQXN5bmNPcGVyYXRpb24vNTczMzk0ODYtNzcxNy00MzY4LWFhMDMtZTQyZjUzZDQzOTk1P2FwaS12ZXJzaW9uPTIwMTctMTItMDE=", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/e87e4845-738b-4423-9f86-92f103f0dd4f?api-version=2017-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uL2U4N2U0ODQ1LTczOGItNDQyMy05Zjg2LTkyZjEwM2YwZGQ0Zj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.25211.01", - "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.0.0" + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.5" ] }, - "ResponseBody": "{\r\n \"name\": \"57339486-7717-4368-aa03-e42f53d43995\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2018-03-29T19:49:06.4Z\"\r\n}", "ResponseHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ], "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 19:50:08 GMT" - ], "Pragma": [ "no-cache" ], - "Transfer-Encoding": [ - "chunked" - ], "Retry-After": [ "60" ], + "x-ms-request-id": [ + "0aff0ca2-c08e-4b84-99aa-6ed69e8de3b4" + ], "Server": [ "Microsoft-HTTPAPI/2.0" ], - "Vary": [ - "Accept-Encoding" - ], - "x-ms-request-id": [ - "49a60e6d-6303-45b0-ad80-4a0b8cd7ad29" - ], "x-ms-ratelimit-remaining-subscription-reads": [ - "14964" + "11999" ], "x-ms-correlation-request-id": [ - "a93f768f-c272-4a37-8ca2-2e8ae669257d" + "61fcce4c-9294-4593-80f1-1be81314c3f5" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T195008Z:a93f768f-c272-4a37-8ca2-2e8ae669257d" + "GERMANYWESTCENTRAL:20200911T173041Z:61fcce4c-9294-4593-80f1-1be81314c3f5" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:30:41 GMT" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" ] }, + "ResponseBody": "{\r\n \"name\": \"e87e4845-738b-4423-9f86-92f103f0dd4f\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-09-11T17:29:40.253Z\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/providers/Microsoft.DBforPostgreSQL/locations/koreasouth/azureAsyncOperation/57339486-7717-4368-aa03-e42f53d43995?api-version=2017-12-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9rb3JlYXNvdXRoL2F6dXJlQXN5bmNPcGVyYXRpb24vNTczMzk0ODYtNzcxNy00MzY4LWFhMDMtZTQyZjUzZDQzOTk1P2FwaS12ZXJzaW9uPTIwMTctMTItMDE=", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/e87e4845-738b-4423-9f86-92f103f0dd4f?api-version=2017-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uL2U4N2U0ODQ1LTczOGItNDQyMy05Zjg2LTkyZjEwM2YwZGQ0Zj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.25211.01", - "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.0.0" + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.5" ] }, - "ResponseBody": "{\r\n \"name\": \"57339486-7717-4368-aa03-e42f53d43995\",\r\n \"status\": \"Succeeded\",\r\n \"startTime\": \"2018-03-29T19:49:06.4Z\"\r\n}", "ResponseHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ], "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 19:51:08 GMT" - ], "Pragma": [ "no-cache" ], - "Transfer-Encoding": [ - "chunked" - ], "Retry-After": [ "60" ], + "x-ms-request-id": [ + "fbb5f000-351d-4966-b990-db78f4a94099" + ], "Server": [ "Microsoft-HTTPAPI/2.0" ], - "Vary": [ - "Accept-Encoding" - ], - "x-ms-request-id": [ - "0b14231d-56d0-4a38-a71f-7145989cfc64" - ], "x-ms-ratelimit-remaining-subscription-reads": [ - "14989" + "11998" ], "x-ms-correlation-request-id": [ - "6060388e-51a7-4082-9e59-8c5070dc878c" + "4c70aacf-565a-4d9f-baa9-14189d88c055" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T195109Z:6060388e-51a7-4082-9e59-8c5070dc878c" + "GERMANYWESTCENTRAL:20200911T173142Z:4c70aacf-565a-4d9f-baa9-14189d88c055" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:31:42 GMT" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" ] }, + "ResponseBody": "{\r\n \"name\": \"e87e4845-738b-4423-9f86-92f103f0dd4f\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-09-11T17:29:40.253Z\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/servers/pgsdkserver?api-version=2017-12-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQmZvclBvc3RncmVTUUwvc2VydmVycy9wZ3Nka3NlcnZlcj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/e87e4845-738b-4423-9f86-92f103f0dd4f?api-version=2017-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uL2U4N2U0ODQ1LTczOGItNDQyMy05Zjg2LTkyZjEwM2YwZGQ0Zj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.25211.01", - "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.0.0" + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.5" ] }, - "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"B_Gen5_1\",\r\n \"tier\": \"Basic\",\r\n \"family\": \"Gen5\",\r\n \"capacity\": 1\r\n },\r\n \"properties\": {\r\n \"administratorLogin\": \"testUser\",\r\n \"storageProfile\": {\r\n \"storageMB\": 5120,\r\n \"backupRetentionDays\": 7,\r\n \"geoRedundantBackup\": \"Disabled\"\r\n },\r\n \"version\": \"9.6\",\r\n \"sslEnforcement\": \"Enabled\",\r\n \"userVisibleState\": \"Ready\",\r\n \"fullyQualifiedDomainName\": \"pgsdkserver.postgres.database.azure.com\",\r\n \"earliestRestoreDate\": \"2018-03-29T12:59:06.747-07:00\",\r\n \"replicationRole\": \"None\",\r\n \"primaryServerId\": \"\",\r\n \"replicaCapacity\": 5\r\n },\r\n \"location\": \"koreasouth\",\r\n \"id\": \"/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/servers/pgsdkserver\",\r\n \"name\": \"pgsdkserver\",\r\n \"type\": \"Microsoft.DBforPostgreSQL/servers\"\r\n}", "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "60" + ], + "x-ms-request-id": [ + "e712bb11-cff4-4331-8bc3-5155457be3d9" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11997" + ], + "x-ms-correlation-request-id": [ + "4a26ab22-2e37-4d3c-907b-3887167af91a" + ], + "x-ms-routing-request-id": [ + "GERMANYWESTCENTRAL:20200911T173243Z:4a26ab22-2e37-4d3c-907b-3887167af91a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:32:42 GMT" + ], + "Content-Length": [ + "107" + ], "Content-Type": [ "application/json; charset=utf-8" ], "Expires": [ "-1" - ], + ] + }, + "ResponseBody": "{\r\n \"name\": \"e87e4845-738b-4423-9f86-92f103f0dd4f\",\r\n \"status\": \"Succeeded\",\r\n \"startTime\": \"2020-09-11T17:29:40.253Z\"\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBForPostgreSQL/servers/pgsdkserver?api-version=2017-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQkZvclBvc3RncmVTUUwvc2VydmVycy9wZ3Nka3NlcnZlcj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.5" + ] + }, + "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 19:51:08 GMT" - ], "Pragma": [ "no-cache" ], - "Transfer-Encoding": [ - "chunked" + "x-ms-request-id": [ + "60a522b4-f53b-4698-8d3f-4f33c2a4fa1f" ], "Server": [ "Microsoft-HTTPAPI/2.0" ], - "Vary": [ - "Accept-Encoding" - ], - "x-ms-request-id": [ - "8b3083ed-3bf3-4ca9-a042-43d591a13495" - ], "x-ms-ratelimit-remaining-subscription-reads": [ - "14988" + "11996" ], "x-ms-correlation-request-id": [ - "7cce56d9-a515-44a2-90ae-5ca770269406" + "c092e7f8-08c9-4661-b625-db539b6da88c" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T195109Z:7cce56d9-a515-44a2-90ae-5ca770269406" + "GERMANYWESTCENTRAL:20200911T173243Z:c092e7f8-08c9-4661-b625-db539b6da88c" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:32:43 GMT" + ], + "Content-Length": [ + "900" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" ] }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"B_Gen5_1\",\r\n \"tier\": \"Basic\",\r\n \"family\": \"Gen5\",\r\n \"capacity\": 1\r\n },\r\n \"properties\": {\r\n \"administratorLogin\": \"testUser\",\r\n \"storageProfile\": {\r\n \"storageMB\": 5120,\r\n \"backupRetentionDays\": 7,\r\n \"geoRedundantBackup\": \"Disabled\",\r\n \"storageAutogrow\": \"Disabled\"\r\n },\r\n \"version\": \"9.6\",\r\n \"sslEnforcement\": \"Enabled\",\r\n \"minimalTlsVersion\": \"TLSEnforcementDisabled\",\r\n \"userVisibleState\": \"Ready\",\r\n \"fullyQualifiedDomainName\": \"pgsdkserver.postgres.database.azure.com\",\r\n \"earliestRestoreDate\": \"2020-09-11T20:39:40.557+03:00\",\r\n \"replicationRole\": \"None\",\r\n \"masterServerId\": \"\",\r\n \"replicaCapacity\": 5,\r\n \"byokEnforcement\": \"Disabled\",\r\n \"privateEndpointConnections\": [],\r\n \"infrastructureEncryption\": \"Disabled\",\r\n \"publicNetworkAccess\": \"Enabled\"\r\n },\r\n \"location\": \"eastus2euap\",\r\n \"id\": \"/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/servers/pgsdkserver\",\r\n \"name\": \"pgsdkserver\",\r\n \"type\": \"Microsoft.DBforPostgreSQL/servers\"\r\n}", "StatusCode": 200 } ], "Names": {}, "Variables": { - "SubscriptionId": "97181df2-909d-420b-ab93-1bff15acb6b7" + "SubscriptionId": "7fec3109-5b78-4a24-b834-5d47d63e2596" } } \ No newline at end of file diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDServiceTests/DeleteResourceSucceeds.json b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDServiceTests/DeleteResourceSucceeds.json index a34887ffd40b1..f862239e139e8 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDServiceTests/DeleteResourceSucceeds.json +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDServiceTests/DeleteResourceSucceeds.json @@ -1,45 +1,34 @@ { "Entries": [ { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourcegroups/pgsdkrg?api-version=2017-05-10", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Jlc291cmNlZ3JvdXBzL3Bnc2Rrcmc/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourcegroups/pgsdkrg?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlZ3JvdXBzL3Bnc2Rrcmc/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", "RequestMethod": "PUT", - "RequestBody": "{\r\n \"location\": \"koreasouth\"\r\n}", + "RequestBody": "{\r\n \"location\": \"eastus2euap\"\r\n}", "RequestHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Content-Length": [ - "32" - ], "x-ms-client-request-id": [ - "fedfb0da-d4b1-4d76-a634-7b774ad3e9df" + "f0d01f34-1a17-4468-86cd-e3d9ed911ef7" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.25211.01", + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" - ] - }, - "ResponseBody": "{\r\n \"id\": \"/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourceGroups/pgsdkrg\",\r\n \"name\": \"pgsdkrg\",\r\n \"location\": \"koreasouth\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", - "ResponseHeaders": { - "Content-Length": [ - "171" ], "Content-Type": [ "application/json; charset=utf-8" ], - "Expires": [ - "-1" - ], + "Content-Length": [ + "33" + ] + }, + "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 19:56:19 GMT" - ], "Pragma": [ "no-cache" ], @@ -47,529 +36,543 @@ "1199" ], "x-ms-request-id": [ - "1e70cd22-b10b-4f3b-b3c0-85189e2b6eca" + "c26795b6-4294-42cf-8497-87ec5dbbe7e3" ], "x-ms-correlation-request-id": [ - "1e70cd22-b10b-4f3b-b3c0-85189e2b6eca" + "c26795b6-4294-42cf-8497-87ec5dbbe7e3" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T195620Z:1e70cd22-b10b-4f3b-b3c0-85189e2b6eca" + "GERMANYWESTCENTRAL:20200911T173806Z:c26795b6-4294-42cf-8497-87ec5dbbe7e3" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:38:06 GMT" + ], + "Content-Length": [ + "172" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" ] }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg\",\r\n \"name\": \"pgsdkrg\",\r\n \"location\": \"eastus2euap\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", "StatusCode": 201 }, { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/servers/pgsdkserver?api-version=2017-12-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQmZvclBvc3RncmVTUUwvc2VydmVycy9wZ3Nka3NlcnZlcj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBForPostgreSQL/servers/pgsdkserver?api-version=2017-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQkZvclBvc3RncmVTUUwvc2VydmVycy9wZ3Nka3NlcnZlcj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", "RequestMethod": "PUT", - "RequestBody": "{\r\n \"sku\": {\r\n \"name\": \"B_Gen5_1\"\r\n },\r\n \"properties\": {\r\n \"createMode\": \"Default\",\r\n \"administratorLogin\": \"testUser\",\r\n \"administratorLoginPassword\": \"testPassword1!\"\r\n },\r\n \"location\": \"koreasouth\"\r\n}", + "RequestBody": "{\r\n \"sku\": {\r\n \"name\": \"B_Gen5_1\"\r\n },\r\n \"properties\": {\r\n \"createMode\": \"Default\",\r\n \"administratorLogin\": \"testUser\",\r\n \"administratorLoginPassword\": \"testPassword1!\"\r\n },\r\n \"location\": \"eastus2euap\"\r\n}", "RequestHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Content-Length": [ - "220" - ], "x-ms-client-request-id": [ - "ca3865d9-7194-49d5-af42-3cf73bb0345a" + "37f4cfbe-7634-43df-9cde-bcfb4e76c1db" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.25211.01", - "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.0.0" - ] - }, - "ResponseBody": "{\r\n \"operation\": \"UpsertElasticServer\",\r\n \"startTime\": \"2018-03-29T19:56:27.12Z\"\r\n}", - "ResponseHeaders": { - "Content-Length": [ - "73" + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.5" ], "Content-Type": [ "application/json; charset=utf-8" ], - "Expires": [ - "-1" - ], + "Content-Length": [ + "221" + ] + }, + "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 19:56:26 GMT" - ], "Pragma": [ "no-cache" ], "Location": [ - "https://management.azure.com/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/providers/Microsoft.DBforPostgreSQL/locations/koreasouth/operationResults/3cb0eceb-6d78-4820-9492-c787878e2a71?api-version=2017-12-01" + "https://management.azure.com/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/operationResults/5981c397-3c60-446a-9ea8-eac3a054d8d4?api-version=2017-12-01" ], "Retry-After": [ "60" ], - "Server": [ - "Microsoft-HTTPAPI/2.0" - ], "Azure-AsyncOperation": [ - "https://management.azure.com/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/providers/Microsoft.DBforPostgreSQL/locations/koreasouth/azureAsyncOperation/3cb0eceb-6d78-4820-9492-c787878e2a71?api-version=2017-12-01" + "https://management.azure.com/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/5981c397-3c60-446a-9ea8-eac3a054d8d4?api-version=2017-12-01" ], "x-ms-request-id": [ - "3cb0eceb-6d78-4820-9492-c787878e2a71" + "5981c397-3c60-446a-9ea8-eac3a054d8d4" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], "x-ms-correlation-request-id": [ - "712ccce9-9385-4bc5-b3c6-0253c2d69e9c" + "b9566daf-62ca-4f5e-9346-4275ed84e073" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T195627Z:712ccce9-9385-4bc5-b3c6-0253c2d69e9c" + "GERMANYWESTCENTRAL:20200911T173813Z:b9566daf-62ca-4f5e-9346-4275ed84e073" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:38:12 GMT" + ], + "Content-Length": [ + "72" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" ] }, + "ResponseBody": "{\r\n \"operation\": \"UpsertElasticServer\",\r\n \"startTime\": \"2020-09-11T17:38:11.9Z\"\r\n}", "StatusCode": 202 }, { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/providers/Microsoft.DBforPostgreSQL/locations/koreasouth/azureAsyncOperation/3cb0eceb-6d78-4820-9492-c787878e2a71?api-version=2017-12-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9rb3JlYXNvdXRoL2F6dXJlQXN5bmNPcGVyYXRpb24vM2NiMGVjZWItNmQ3OC00ODIwLTk0OTItYzc4Nzg3OGUyYTcxP2FwaS12ZXJzaW9uPTIwMTctMTItMDE=", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/5981c397-3c60-446a-9ea8-eac3a054d8d4?api-version=2017-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uLzU5ODFjMzk3LTNjNjAtNDQ2YS05ZWE4LWVhYzNhMDU0ZDhkND9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.25211.01", - "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.0.0" + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.5" ] }, - "ResponseBody": "{\r\n \"name\": \"3cb0eceb-6d78-4820-9492-c787878e2a71\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2018-03-29T19:56:27.12Z\"\r\n}", "ResponseHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ], "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 19:57:28 GMT" - ], "Pragma": [ "no-cache" ], - "Transfer-Encoding": [ - "chunked" - ], "Retry-After": [ "60" ], + "x-ms-request-id": [ + "6814dccb-8d18-4036-ac05-50ebbcd6313e" + ], "Server": [ "Microsoft-HTTPAPI/2.0" ], - "Vary": [ - "Accept-Encoding" - ], - "x-ms-request-id": [ - "4731e56b-2dc3-4ea0-9a92-6a4e58e80eba" - ], "x-ms-ratelimit-remaining-subscription-reads": [ - "14982" + "11999" ], "x-ms-correlation-request-id": [ - "c0fd7f27-2824-4cee-bcf9-3b2eebe5d30f" + "85fdd60d-0a77-4caf-ab8b-566ebc789fa1" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T195728Z:c0fd7f27-2824-4cee-bcf9-3b2eebe5d30f" + "GERMANYWESTCENTRAL:20200911T173913Z:85fdd60d-0a77-4caf-ab8b-566ebc789fa1" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:39:12 GMT" + ], + "Content-Length": [ + "106" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" ] }, + "ResponseBody": "{\r\n \"name\": \"5981c397-3c60-446a-9ea8-eac3a054d8d4\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-09-11T17:38:11.9Z\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/providers/Microsoft.DBforPostgreSQL/locations/koreasouth/azureAsyncOperation/3cb0eceb-6d78-4820-9492-c787878e2a71?api-version=2017-12-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9rb3JlYXNvdXRoL2F6dXJlQXN5bmNPcGVyYXRpb24vM2NiMGVjZWItNmQ3OC00ODIwLTk0OTItYzc4Nzg3OGUyYTcxP2FwaS12ZXJzaW9uPTIwMTctMTItMDE=", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/5981c397-3c60-446a-9ea8-eac3a054d8d4?api-version=2017-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uLzU5ODFjMzk3LTNjNjAtNDQ2YS05ZWE4LWVhYzNhMDU0ZDhkND9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.25211.01", - "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.0.0" + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.5" ] }, - "ResponseBody": "{\r\n \"name\": \"3cb0eceb-6d78-4820-9492-c787878e2a71\",\r\n \"status\": \"Succeeded\",\r\n \"startTime\": \"2018-03-29T19:56:27.12Z\"\r\n}", "ResponseHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ], "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 19:58:28 GMT" - ], "Pragma": [ "no-cache" ], - "Transfer-Encoding": [ - "chunked" - ], "Retry-After": [ "60" ], + "x-ms-request-id": [ + "add733e2-b3cd-4872-9ae6-0710be73b978" + ], "Server": [ "Microsoft-HTTPAPI/2.0" ], - "Vary": [ - "Accept-Encoding" - ], - "x-ms-request-id": [ - "ebfc0c70-1443-4265-bba4-8c049d2dce13" - ], "x-ms-ratelimit-remaining-subscription-reads": [ - "14978" + "11998" ], "x-ms-correlation-request-id": [ - "a51ccda4-18b0-4e6a-8184-6f402e615b3d" + "39ef7802-ac94-4fc9-a43d-c2cb1bc5caa8" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T195829Z:a51ccda4-18b0-4e6a-8184-6f402e615b3d" + "GERMANYWESTCENTRAL:20200911T174014Z:39ef7802-ac94-4fc9-a43d-c2cb1bc5caa8" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:40:13 GMT" + ], + "Content-Length": [ + "105" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" ] }, + "ResponseBody": "{\r\n \"name\": \"5981c397-3c60-446a-9ea8-eac3a054d8d4\",\r\n \"status\": \"Succeeded\",\r\n \"startTime\": \"2020-09-11T17:38:11.9Z\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/servers/pgsdkserver?api-version=2017-12-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQmZvclBvc3RncmVTUUwvc2VydmVycy9wZ3Nka3NlcnZlcj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBForPostgreSQL/servers/pgsdkserver?api-version=2017-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQkZvclBvc3RncmVTUUwvc2VydmVycy9wZ3Nka3NlcnZlcj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.25211.01", - "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.0.0" + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.5" ] }, - "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"B_Gen5_1\",\r\n \"tier\": \"Basic\",\r\n \"family\": \"Gen5\",\r\n \"capacity\": 1\r\n },\r\n \"properties\": {\r\n \"administratorLogin\": \"testUser\",\r\n \"storageProfile\": {\r\n \"storageMB\": 5120,\r\n \"backupRetentionDays\": 7,\r\n \"geoRedundantBackup\": \"Disabled\"\r\n },\r\n \"version\": \"9.6\",\r\n \"sslEnforcement\": \"Enabled\",\r\n \"userVisibleState\": \"Ready\",\r\n \"fullyQualifiedDomainName\": \"pgsdkserver.postgres.database.azure.com\",\r\n \"earliestRestoreDate\": \"2018-03-29T13:06:27.493-07:00\",\r\n \"replicationRole\": \"None\",\r\n \"primaryServerId\": \"\",\r\n \"replicaCapacity\": 5\r\n },\r\n \"location\": \"koreasouth\",\r\n \"id\": \"/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/servers/pgsdkserver\",\r\n \"name\": \"pgsdkserver\",\r\n \"type\": \"Microsoft.DBforPostgreSQL/servers\"\r\n}", "ResponseHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ], "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 19:58:28 GMT" - ], "Pragma": [ "no-cache" ], - "Transfer-Encoding": [ - "chunked" + "x-ms-request-id": [ + "7033bb74-038b-4be1-9977-319b57aa8417" ], "Server": [ "Microsoft-HTTPAPI/2.0" ], - "Vary": [ - "Accept-Encoding" - ], - "x-ms-request-id": [ - "cd94ea54-9d90-4912-a210-4fb5c08a6bfc" - ], "x-ms-ratelimit-remaining-subscription-reads": [ - "14977" + "11997" ], "x-ms-correlation-request-id": [ - "5c326e62-22cc-4575-8acb-44cd0864da7a" + "344ac712-ada0-4023-a463-f4311dd22f0d" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T195829Z:5c326e62-22cc-4575-8acb-44cd0864da7a" + "GERMANYWESTCENTRAL:20200911T174014Z:344ac712-ada0-4023-a463-f4311dd22f0d" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:40:13 GMT" + ], + "Content-Length": [ + "900" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" ] }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"B_Gen5_1\",\r\n \"tier\": \"Basic\",\r\n \"family\": \"Gen5\",\r\n \"capacity\": 1\r\n },\r\n \"properties\": {\r\n \"administratorLogin\": \"testUser\",\r\n \"storageProfile\": {\r\n \"storageMB\": 5120,\r\n \"backupRetentionDays\": 7,\r\n \"geoRedundantBackup\": \"Disabled\",\r\n \"storageAutogrow\": \"Disabled\"\r\n },\r\n \"version\": \"9.6\",\r\n \"sslEnforcement\": \"Enabled\",\r\n \"minimalTlsVersion\": \"TLSEnforcementDisabled\",\r\n \"userVisibleState\": \"Ready\",\r\n \"fullyQualifiedDomainName\": \"pgsdkserver.postgres.database.azure.com\",\r\n \"earliestRestoreDate\": \"2020-09-11T20:48:12.223+03:00\",\r\n \"replicationRole\": \"None\",\r\n \"masterServerId\": \"\",\r\n \"replicaCapacity\": 5,\r\n \"byokEnforcement\": \"Disabled\",\r\n \"privateEndpointConnections\": [],\r\n \"infrastructureEncryption\": \"Disabled\",\r\n \"publicNetworkAccess\": \"Enabled\"\r\n },\r\n \"location\": \"eastus2euap\",\r\n \"id\": \"/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/servers/pgsdkserver\",\r\n \"name\": \"pgsdkserver\",\r\n \"type\": \"Microsoft.DBforPostgreSQL/servers\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/servers/pgsdkserver?api-version=2017-12-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQmZvclBvc3RncmVTUUwvc2VydmVycy9wZ3Nka3NlcnZlcj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBForPostgreSQL/servers/pgsdkserver?api-version=2017-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQkZvclBvc3RncmVTUUwvc2VydmVycy9wZ3Nka3NlcnZlcj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "x-ms-client-request-id": [ - "59816c5f-7848-465f-9f57-6545f2cba6fd" + "b584c9fd-f6dd-4dbf-a9f8-e16985201c2d" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.25211.01", - "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.0.0" + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.5" ] }, - "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"B_Gen5_1\",\r\n \"tier\": \"Basic\",\r\n \"family\": \"Gen5\",\r\n \"capacity\": 1\r\n },\r\n \"properties\": {\r\n \"administratorLogin\": \"testUser\",\r\n \"storageProfile\": {\r\n \"storageMB\": 5120,\r\n \"backupRetentionDays\": 7,\r\n \"geoRedundantBackup\": \"Disabled\"\r\n },\r\n \"version\": \"9.6\",\r\n \"sslEnforcement\": \"Enabled\",\r\n \"userVisibleState\": \"Ready\",\r\n \"fullyQualifiedDomainName\": \"pgsdkserver.postgres.database.azure.com\",\r\n \"earliestRestoreDate\": \"2018-03-29T13:06:27.493-07:00\",\r\n \"replicationRole\": \"None\",\r\n \"primaryServerId\": \"\",\r\n \"replicaCapacity\": 5\r\n },\r\n \"location\": \"koreasouth\",\r\n \"id\": \"/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/servers/pgsdkserver\",\r\n \"name\": \"pgsdkserver\",\r\n \"type\": \"Microsoft.DBforPostgreSQL/servers\"\r\n}", "ResponseHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ], "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 19:58:29 GMT" - ], "Pragma": [ "no-cache" ], - "Transfer-Encoding": [ - "chunked" + "x-ms-request-id": [ + "17e4d340-0f8a-44cc-9e85-118e207c4025" ], "Server": [ "Microsoft-HTTPAPI/2.0" ], - "Vary": [ - "Accept-Encoding" - ], - "x-ms-request-id": [ - "2277e97e-0da8-485f-8c2f-78b3af1e3539" - ], "x-ms-ratelimit-remaining-subscription-reads": [ - "14976" + "11996" ], "x-ms-correlation-request-id": [ - "d7bf32a3-91be-4eb4-9c86-b71248033d80" + "9c0272c4-033e-4f3d-8e33-18d2a62d5e83" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T195829Z:d7bf32a3-91be-4eb4-9c86-b71248033d80" + "GERMANYWESTCENTRAL:20200911T174014Z:9c0272c4-033e-4f3d-8e33-18d2a62d5e83" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:40:14 GMT" + ], + "Content-Length": [ + "900" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" ] }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"B_Gen5_1\",\r\n \"tier\": \"Basic\",\r\n \"family\": \"Gen5\",\r\n \"capacity\": 1\r\n },\r\n \"properties\": {\r\n \"administratorLogin\": \"testUser\",\r\n \"storageProfile\": {\r\n \"storageMB\": 5120,\r\n \"backupRetentionDays\": 7,\r\n \"geoRedundantBackup\": \"Disabled\",\r\n \"storageAutogrow\": \"Disabled\"\r\n },\r\n \"version\": \"9.6\",\r\n \"sslEnforcement\": \"Enabled\",\r\n \"minimalTlsVersion\": \"TLSEnforcementDisabled\",\r\n \"userVisibleState\": \"Ready\",\r\n \"fullyQualifiedDomainName\": \"pgsdkserver.postgres.database.azure.com\",\r\n \"earliestRestoreDate\": \"2020-09-11T20:48:12.223+03:00\",\r\n \"replicationRole\": \"None\",\r\n \"masterServerId\": \"\",\r\n \"replicaCapacity\": 5,\r\n \"byokEnforcement\": \"Disabled\",\r\n \"privateEndpointConnections\": [],\r\n \"infrastructureEncryption\": \"Disabled\",\r\n \"publicNetworkAccess\": \"Enabled\"\r\n },\r\n \"location\": \"eastus2euap\",\r\n \"id\": \"/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/servers/pgsdkserver\",\r\n \"name\": \"pgsdkserver\",\r\n \"type\": \"Microsoft.DBforPostgreSQL/servers\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/servers/pgsdkserver?api-version=2017-12-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQmZvclBvc3RncmVTUUwvc2VydmVycy9wZ3Nka3NlcnZlcj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBForPostgreSQL/servers/pgsdkserver?api-version=2017-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQkZvclBvc3RncmVTUUwvc2VydmVycy9wZ3Nka3NlcnZlcj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", "RequestMethod": "DELETE", "RequestBody": "", "RequestHeaders": { "x-ms-client-request-id": [ - "f7565614-7bdd-40f9-8d39-8128365f3913" + "943303ed-0eb1-461d-be2e-e2aa4a0585fa" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.25211.01", - "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.0.0" + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.5" ] }, - "ResponseBody": "{\r\n \"operation\": \"DropElasticServer\",\r\n \"startTime\": \"2018-03-29T19:58:31.03Z\"\r\n}", "ResponseHeaders": { - "Content-Length": [ - "71" - ], - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ], "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 19:58:30 GMT" - ], "Pragma": [ "no-cache" ], "Location": [ - "https://management.azure.com/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/providers/Microsoft.DBforPostgreSQL/locations/koreasouth/operationResults/2dfba9b1-94d0-4134-bc2b-c5e9b206c422?api-version=2017-12-01" + "https://management.azure.com/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/operationResults/050d894f-b459-4ab6-ac87-6c1c55f5291b?api-version=2017-12-01" ], "Retry-After": [ "15" ], - "Server": [ - "Microsoft-HTTPAPI/2.0" - ], "Azure-AsyncOperation": [ - "https://management.azure.com/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/providers/Microsoft.DBforPostgreSQL/locations/koreasouth/azureAsyncOperation/2dfba9b1-94d0-4134-bc2b-c5e9b206c422?api-version=2017-12-01" + "https://management.azure.com/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/050d894f-b459-4ab6-ac87-6c1c55f5291b?api-version=2017-12-01" ], "x-ms-request-id": [ - "2dfba9b1-94d0-4134-bc2b-c5e9b206c422" + "050d894f-b459-4ab6-ac87-6c1c55f5291b" ], - "x-ms-ratelimit-remaining-subscription-writes": [ - "1199" + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14999" ], "x-ms-correlation-request-id": [ - "ef08b360-3c16-4dc6-b8d4-5c2629f132d0" + "162345a1-e4d2-4215-8e6e-eebc6ff56b45" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T195831Z:ef08b360-3c16-4dc6-b8d4-5c2629f132d0" + "GERMANYWESTCENTRAL:20200911T174015Z:162345a1-e4d2-4215-8e6e-eebc6ff56b45" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:40:15 GMT" + ], + "Content-Length": [ + "72" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" ] }, + "ResponseBody": "{\r\n \"operation\": \"DropElasticServer\",\r\n \"startTime\": \"2020-09-11T17:40:15.567Z\"\r\n}", "StatusCode": 202 }, { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/providers/Microsoft.DBforPostgreSQL/locations/koreasouth/azureAsyncOperation/2dfba9b1-94d0-4134-bc2b-c5e9b206c422?api-version=2017-12-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9rb3JlYXNvdXRoL2F6dXJlQXN5bmNPcGVyYXRpb24vMmRmYmE5YjEtOTRkMC00MTM0LWJjMmItYzVlOWIyMDZjNDIyP2FwaS12ZXJzaW9uPTIwMTctMTItMDE=", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/050d894f-b459-4ab6-ac87-6c1c55f5291b?api-version=2017-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uLzA1MGQ4OTRmLWI0NTktNGFiNi1hYzg3LTZjMWM1NWY1MjkxYj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.25211.01", - "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.0.0" + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.5" ] }, - "ResponseBody": "{\r\n \"name\": \"2dfba9b1-94d0-4134-bc2b-c5e9b206c422\",\r\n \"status\": \"Succeeded\",\r\n \"startTime\": \"2018-03-29T19:58:31.03Z\"\r\n}", "ResponseHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ], "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 19:58:46 GMT" - ], "Pragma": [ "no-cache" ], - "Transfer-Encoding": [ - "chunked" - ], "Retry-After": [ "15" ], + "x-ms-request-id": [ + "fbbe9b56-cb20-470a-afaf-e63d436d5c14" + ], "Server": [ "Microsoft-HTTPAPI/2.0" ], - "Vary": [ - "Accept-Encoding" - ], - "x-ms-request-id": [ - "a9c7a74e-44d0-4b71-9f98-7de0f75e842b" - ], "x-ms-ratelimit-remaining-subscription-reads": [ - "14975" + "11995" ], "x-ms-correlation-request-id": [ - "53c47fe2-8fce-4979-b2aa-0d3b7b3b872d" + "d8e09ae2-8fff-48c1-aeba-846eb3f21698" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T195846Z:53c47fe2-8fce-4979-b2aa-0d3b7b3b872d" + "GERMANYWESTCENTRAL:20200911T174030Z:d8e09ae2-8fff-48c1-aeba-846eb3f21698" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:40:30 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" ] }, + "ResponseBody": "{\r\n \"name\": \"050d894f-b459-4ab6-ac87-6c1c55f5291b\",\r\n \"status\": \"Succeeded\",\r\n \"startTime\": \"2020-09-11T17:40:15.567Z\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/providers/Microsoft.DBforPostgreSQL/locations/koreasouth/operationResults/2dfba9b1-94d0-4134-bc2b-c5e9b206c422?api-version=2017-12-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9rb3JlYXNvdXRoL29wZXJhdGlvblJlc3VsdHMvMmRmYmE5YjEtOTRkMC00MTM0LWJjMmItYzVlOWIyMDZjNDIyP2FwaS12ZXJzaW9uPTIwMTctMTItMDE=", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/operationResults/050d894f-b459-4ab6-ac87-6c1c55f5291b?api-version=2017-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9vcGVyYXRpb25SZXN1bHRzLzA1MGQ4OTRmLWI0NTktNGFiNi1hYzg3LTZjMWM1NWY1MjkxYj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.25211.01", - "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.0.0" + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.5" ] }, - "ResponseBody": "", "ResponseHeaders": { - "Content-Length": [ - "0" - ], - "Expires": [ - "-1" - ], "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 19:58:46 GMT" - ], "Pragma": [ "no-cache" ], + "x-ms-request-id": [ + "559a5651-d1c6-4ac7-8379-9853cbd5adcd" + ], "Server": [ "Microsoft-HTTPAPI/2.0" ], - "x-ms-request-id": [ - "1af294d4-78d7-4383-8b08-fd514cf28e78" - ], "x-ms-ratelimit-remaining-subscription-reads": [ - "14974" + "11994" ], "x-ms-correlation-request-id": [ - "b3f6005b-3bb5-4cf6-8c3c-22faecd40734" + "30f44b73-7290-4e1f-8d9b-08451b7ba915" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T195847Z:b3f6005b-3bb5-4cf6-8c3c-22faecd40734" + "GERMANYWESTCENTRAL:20200911T174031Z:30f44b73-7290-4e1f-8d9b-08451b7ba915" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:40:30 GMT" + ], + "Expires": [ + "-1" + ], + "Content-Length": [ + "0" ] }, + "ResponseBody": "", "StatusCode": 200 } ], "Names": {}, "Variables": { - "SubscriptionId": "97181df2-909d-420b-ab93-1bff15acb6b7" + "SubscriptionId": "7fec3109-5b78-4a24-b834-5d47d63e2596" } } \ No newline at end of file diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDServiceTests/GetResourceSucceeds.json b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDServiceTests/GetResourceSucceeds.json index 136427cd05c51..6385fa490e0a1 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDServiceTests/GetResourceSucceeds.json +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/tests/SessionRecords/CRUDServiceTests/GetResourceSucceeds.json @@ -1,45 +1,34 @@ { "Entries": [ { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourcegroups/pgsdkrg?api-version=2017-05-10", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Jlc291cmNlZ3JvdXBzL3Bnc2Rrcmc/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourcegroups/pgsdkrg?api-version=2017-05-10", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlZ3JvdXBzL3Bnc2Rrcmc/YXBpLXZlcnNpb249MjAxNy0wNS0xMA==", "RequestMethod": "PUT", - "RequestBody": "{\r\n \"location\": \"koreasouth\"\r\n}", + "RequestBody": "{\r\n \"location\": \"eastus2euap\"\r\n}", "RequestHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Content-Length": [ - "32" - ], "x-ms-client-request-id": [ - "88da65fd-6ae4-4f91-bc31-8aa6f199cbcb" + "a4a971c9-e416-4367-9927-f8fecf23de0d" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.25211.01", + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient/1.6.0.0" - ] - }, - "ResponseBody": "{\r\n \"id\": \"/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourceGroups/pgsdkrg\",\r\n \"name\": \"pgsdkrg\",\r\n \"location\": \"koreasouth\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", - "ResponseHeaders": { - "Content-Length": [ - "171" ], "Content-Type": [ "application/json; charset=utf-8" ], - "Expires": [ - "-1" - ], + "Content-Length": [ + "33" + ] + }, + "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 20:03:55 GMT" - ], "Pragma": [ "no-cache" ], @@ -47,346 +36,357 @@ "1199" ], "x-ms-request-id": [ - "aee4f162-00d2-4277-ad54-3b4f5e84aa13" + "e0993c81-54e7-459f-98ca-7fdf42b1a592" ], "x-ms-correlation-request-id": [ - "aee4f162-00d2-4277-ad54-3b4f5e84aa13" + "e0993c81-54e7-459f-98ca-7fdf42b1a592" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T200356Z:aee4f162-00d2-4277-ad54-3b4f5e84aa13" + "GERMANYWESTCENTRAL:20200911T174549Z:e0993c81-54e7-459f-98ca-7fdf42b1a592" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:45:48 GMT" + ], + "Content-Length": [ + "172" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" ] }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg\",\r\n \"name\": \"pgsdkrg\",\r\n \"location\": \"eastus2euap\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", "StatusCode": 201 }, { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/servers/pgsdkserver?api-version=2017-12-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQmZvclBvc3RncmVTUUwvc2VydmVycy9wZ3Nka3NlcnZlcj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBForPostgreSQL/servers/pgsdkserver?api-version=2017-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQkZvclBvc3RncmVTUUwvc2VydmVycy9wZ3Nka3NlcnZlcj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", "RequestMethod": "PUT", - "RequestBody": "{\r\n \"sku\": {\r\n \"name\": \"B_Gen5_1\"\r\n },\r\n \"properties\": {\r\n \"createMode\": \"Default\",\r\n \"administratorLogin\": \"testUser\",\r\n \"administratorLoginPassword\": \"testPassword1!\"\r\n },\r\n \"location\": \"koreasouth\"\r\n}", + "RequestBody": "{\r\n \"sku\": {\r\n \"name\": \"B_Gen5_1\"\r\n },\r\n \"properties\": {\r\n \"createMode\": \"Default\",\r\n \"administratorLogin\": \"testUser\",\r\n \"administratorLoginPassword\": \"testPassword1!\"\r\n },\r\n \"location\": \"eastus2euap\"\r\n}", "RequestHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Content-Length": [ - "220" - ], "x-ms-client-request-id": [ - "a8e7fccb-f5f8-455f-890c-00e5aed5cc61" + "e9e49a55-6df7-4fd2-9b45-a8ffe0ac0fab" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.25211.01", - "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.0.0" - ] - }, - "ResponseBody": "{\r\n \"operation\": \"UpsertElasticServer\",\r\n \"startTime\": \"2018-03-29T20:04:02.747Z\"\r\n}", - "ResponseHeaders": { - "Content-Length": [ - "74" + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.5" ], "Content-Type": [ "application/json; charset=utf-8" ], - "Expires": [ - "-1" - ], + "Content-Length": [ + "221" + ] + }, + "ResponseHeaders": { "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 20:04:02 GMT" - ], "Pragma": [ "no-cache" ], "Location": [ - "https://management.azure.com/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/providers/Microsoft.DBforPostgreSQL/locations/koreasouth/operationResults/a7a016a2-9b61-4ae4-9c3c-ad3f0a115026?api-version=2017-12-01" + "https://management.azure.com/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/operationResults/660d7534-dd9c-4170-8099-8f01846a243d?api-version=2017-12-01" ], "Retry-After": [ "60" ], - "Server": [ - "Microsoft-HTTPAPI/2.0" - ], "Azure-AsyncOperation": [ - "https://management.azure.com/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/providers/Microsoft.DBforPostgreSQL/locations/koreasouth/azureAsyncOperation/a7a016a2-9b61-4ae4-9c3c-ad3f0a115026?api-version=2017-12-01" + "https://management.azure.com/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/660d7534-dd9c-4170-8099-8f01846a243d?api-version=2017-12-01" ], "x-ms-request-id": [ - "a7a016a2-9b61-4ae4-9c3c-ad3f0a115026" + "660d7534-dd9c-4170-8099-8f01846a243d" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" ], "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], "x-ms-correlation-request-id": [ - "178ca224-eb6c-4031-8b72-b57ec0612dd0" + "80883631-e3c7-4491-a1bb-5ee7ae915730" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T200402Z:178ca224-eb6c-4031-8b72-b57ec0612dd0" + "GERMANYWESTCENTRAL:20200911T174556Z:80883631-e3c7-4491-a1bb-5ee7ae915730" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:45:56 GMT" + ], + "Content-Length": [ + "74" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" ] }, + "ResponseBody": "{\r\n \"operation\": \"UpsertElasticServer\",\r\n \"startTime\": \"2020-09-11T17:45:55.193Z\"\r\n}", "StatusCode": 202 }, { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/providers/Microsoft.DBforPostgreSQL/locations/koreasouth/azureAsyncOperation/a7a016a2-9b61-4ae4-9c3c-ad3f0a115026?api-version=2017-12-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9rb3JlYXNvdXRoL2F6dXJlQXN5bmNPcGVyYXRpb24vYTdhMDE2YTItOWI2MS00YWU0LTljM2MtYWQzZjBhMTE1MDI2P2FwaS12ZXJzaW9uPTIwMTctMTItMDE=", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/660d7534-dd9c-4170-8099-8f01846a243d?api-version=2017-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uLzY2MGQ3NTM0LWRkOWMtNDE3MC04MDk5LThmMDE4NDZhMjQzZD9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.25211.01", - "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.0.0" + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.5" ] }, - "ResponseBody": "{\r\n \"name\": \"a7a016a2-9b61-4ae4-9c3c-ad3f0a115026\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2018-03-29T20:04:02.747Z\"\r\n}", "ResponseHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ], "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 20:05:03 GMT" - ], "Pragma": [ "no-cache" ], - "Transfer-Encoding": [ - "chunked" - ], "Retry-After": [ "60" ], + "x-ms-request-id": [ + "47aaf831-3f31-4f10-b03c-2f4cbf1a8aff" + ], "Server": [ "Microsoft-HTTPAPI/2.0" ], - "Vary": [ - "Accept-Encoding" - ], - "x-ms-request-id": [ - "7e314991-893e-4fb7-8fa9-397b6630c2ad" - ], "x-ms-ratelimit-remaining-subscription-reads": [ - "14978" + "11999" ], "x-ms-correlation-request-id": [ - "2246ca5c-a235-4a2d-9e97-fb819337774f" + "3de020ac-8100-4e97-9707-2147801a6b3c" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T200503Z:2246ca5c-a235-4a2d-9e97-fb819337774f" + "GERMANYWESTCENTRAL:20200911T174656Z:3de020ac-8100-4e97-9707-2147801a6b3c" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:46:56 GMT" + ], + "Content-Length": [ + "108" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" ] }, + "ResponseBody": "{\r\n \"name\": \"660d7534-dd9c-4170-8099-8f01846a243d\",\r\n \"status\": \"InProgress\",\r\n \"startTime\": \"2020-09-11T17:45:55.193Z\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/providers/Microsoft.DBforPostgreSQL/locations/koreasouth/azureAsyncOperation/a7a016a2-9b61-4ae4-9c3c-ad3f0a115026?api-version=2017-12-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9rb3JlYXNvdXRoL2F6dXJlQXN5bmNPcGVyYXRpb24vYTdhMDE2YTItOWI2MS00YWU0LTljM2MtYWQzZjBhMTE1MDI2P2FwaS12ZXJzaW9uPTIwMTctMTItMDE=", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/providers/Microsoft.DBforPostgreSQL/locations/eastus2euap/azureAsyncOperation/660d7534-dd9c-4170-8099-8f01846a243d?api-version=2017-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Byb3ZpZGVycy9NaWNyb3NvZnQuREJmb3JQb3N0Z3JlU1FML2xvY2F0aW9ucy9lYXN0dXMyZXVhcC9henVyZUFzeW5jT3BlcmF0aW9uLzY2MGQ3NTM0LWRkOWMtNDE3MC04MDk5LThmMDE4NDZhMjQzZD9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.25211.01", - "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.0.0" + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.5" ] }, - "ResponseBody": "{\r\n \"name\": \"a7a016a2-9b61-4ae4-9c3c-ad3f0a115026\",\r\n \"status\": \"Succeeded\",\r\n \"startTime\": \"2018-03-29T20:04:02.747Z\"\r\n}", "ResponseHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ], "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 20:06:04 GMT" - ], "Pragma": [ "no-cache" ], - "Transfer-Encoding": [ - "chunked" - ], "Retry-After": [ "60" ], + "x-ms-request-id": [ + "bd3fc900-c25c-4747-89bc-c7a8a2653c1c" + ], "Server": [ "Microsoft-HTTPAPI/2.0" ], - "Vary": [ - "Accept-Encoding" - ], - "x-ms-request-id": [ - "dc29018a-48cd-4c59-80b8-aa1996f80e0d" - ], "x-ms-ratelimit-remaining-subscription-reads": [ - "14981" + "11998" ], "x-ms-correlation-request-id": [ - "a85c26d0-d181-4d58-976c-18dad7cdde3d" + "9d62695a-e079-495b-98c4-6bbc2d668984" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T200604Z:a85c26d0-d181-4d58-976c-18dad7cdde3d" + "GERMANYWESTCENTRAL:20200911T174757Z:9d62695a-e079-495b-98c4-6bbc2d668984" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:47:56 GMT" + ], + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" ] }, + "ResponseBody": "{\r\n \"name\": \"660d7534-dd9c-4170-8099-8f01846a243d\",\r\n \"status\": \"Succeeded\",\r\n \"startTime\": \"2020-09-11T17:45:55.193Z\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/servers/pgsdkserver?api-version=2017-12-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQmZvclBvc3RncmVTUUwvc2VydmVycy9wZ3Nka3NlcnZlcj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBForPostgreSQL/servers/pgsdkserver?api-version=2017-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQkZvclBvc3RncmVTUUwvc2VydmVycy9wZ3Nka3NlcnZlcj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "User-Agent": [ - "FxVersion/4.6.25211.01", - "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.0.0" + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.5" ] }, - "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"B_Gen5_1\",\r\n \"tier\": \"Basic\",\r\n \"family\": \"Gen5\",\r\n \"capacity\": 1\r\n },\r\n \"properties\": {\r\n \"administratorLogin\": \"testUser\",\r\n \"storageProfile\": {\r\n \"storageMB\": 5120,\r\n \"backupRetentionDays\": 7,\r\n \"geoRedundantBackup\": \"Disabled\"\r\n },\r\n \"version\": \"9.6\",\r\n \"sslEnforcement\": \"Enabled\",\r\n \"userVisibleState\": \"Ready\",\r\n \"fullyQualifiedDomainName\": \"pgsdkserver.postgres.database.azure.com\",\r\n \"earliestRestoreDate\": \"2018-03-29T13:14:03.047-07:00\",\r\n \"replicationRole\": \"None\",\r\n \"primaryServerId\": \"\",\r\n \"replicaCapacity\": 5\r\n },\r\n \"location\": \"koreasouth\",\r\n \"id\": \"/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/servers/pgsdkserver\",\r\n \"name\": \"pgsdkserver\",\r\n \"type\": \"Microsoft.DBforPostgreSQL/servers\"\r\n}", "ResponseHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ], "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 20:06:04 GMT" - ], "Pragma": [ "no-cache" ], - "Transfer-Encoding": [ - "chunked" + "x-ms-request-id": [ + "f62b62e8-174f-485e-9f0d-c9ed5ceed92a" ], "Server": [ "Microsoft-HTTPAPI/2.0" ], - "Vary": [ - "Accept-Encoding" - ], - "x-ms-request-id": [ - "210dc31d-3408-411c-90c4-336ddd8227cc" - ], "x-ms-ratelimit-remaining-subscription-reads": [ - "14980" + "11997" ], "x-ms-correlation-request-id": [ - "8a907ae5-0306-4957-9b0a-8d29c17f73a6" + "57777a6d-dcd3-4470-b02d-1a4a27dadbed" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T200605Z:8a907ae5-0306-4957-9b0a-8d29c17f73a6" + "GERMANYWESTCENTRAL:20200911T174757Z:57777a6d-dcd3-4470-b02d-1a4a27dadbed" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:47:56 GMT" + ], + "Content-Length": [ + "900" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" ] }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"B_Gen5_1\",\r\n \"tier\": \"Basic\",\r\n \"family\": \"Gen5\",\r\n \"capacity\": 1\r\n },\r\n \"properties\": {\r\n \"administratorLogin\": \"testUser\",\r\n \"storageProfile\": {\r\n \"storageMB\": 5120,\r\n \"backupRetentionDays\": 7,\r\n \"geoRedundantBackup\": \"Disabled\",\r\n \"storageAutogrow\": \"Disabled\"\r\n },\r\n \"version\": \"9.6\",\r\n \"sslEnforcement\": \"Enabled\",\r\n \"minimalTlsVersion\": \"TLSEnforcementDisabled\",\r\n \"userVisibleState\": \"Ready\",\r\n \"fullyQualifiedDomainName\": \"pgsdkserver.postgres.database.azure.com\",\r\n \"earliestRestoreDate\": \"2020-09-11T20:55:55.513+03:00\",\r\n \"replicationRole\": \"None\",\r\n \"masterServerId\": \"\",\r\n \"replicaCapacity\": 5,\r\n \"byokEnforcement\": \"Disabled\",\r\n \"privateEndpointConnections\": [],\r\n \"infrastructureEncryption\": \"Disabled\",\r\n \"publicNetworkAccess\": \"Enabled\"\r\n },\r\n \"location\": \"eastus2euap\",\r\n \"id\": \"/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/servers/pgsdkserver\",\r\n \"name\": \"pgsdkserver\",\r\n \"type\": \"Microsoft.DBforPostgreSQL/servers\"\r\n}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/servers/pgsdkserver?api-version=2017-12-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTcxODFkZjItOTA5ZC00MjBiLWFiOTMtMWJmZjE1YWNiNmI3L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQmZvclBvc3RncmVTUUwvc2VydmVycy9wZ3Nka3NlcnZlcj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", + "RequestUri": "/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBForPostgreSQL/servers/pgsdkserver?api-version=2017-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvN2ZlYzMxMDktNWI3OC00YTI0LWI4MzQtNWQ0N2Q2M2UyNTk2L3Jlc291cmNlR3JvdXBzL3Bnc2RrcmcvcHJvdmlkZXJzL01pY3Jvc29mdC5EQkZvclBvc3RncmVTUUwvc2VydmVycy9wZ3Nka3NlcnZlcj9hcGktdmVyc2lvbj0yMDE3LTEyLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { "x-ms-client-request-id": [ - "f5248def-bf6d-438d-8e4f-62354a9b344e" + "fd9893eb-e9c7-43f0-95f6-8440f2313cae" ], - "accept-language": [ + "Accept-Language": [ "en-US" ], "User-Agent": [ - "FxVersion/4.6.25211.01", - "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.0.0" + "FxVersion/4.6.29130.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.20211.", + "Microsoft.Azure.Management.PostgreSQL.PostgreSQLManagementClient/0.9.5" ] }, - "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"B_Gen5_1\",\r\n \"tier\": \"Basic\",\r\n \"family\": \"Gen5\",\r\n \"capacity\": 1\r\n },\r\n \"properties\": {\r\n \"administratorLogin\": \"testUser\",\r\n \"storageProfile\": {\r\n \"storageMB\": 5120,\r\n \"backupRetentionDays\": 7,\r\n \"geoRedundantBackup\": \"Disabled\"\r\n },\r\n \"version\": \"9.6\",\r\n \"sslEnforcement\": \"Enabled\",\r\n \"userVisibleState\": \"Ready\",\r\n \"fullyQualifiedDomainName\": \"pgsdkserver.postgres.database.azure.com\",\r\n \"earliestRestoreDate\": \"2018-03-29T13:14:03.047-07:00\",\r\n \"replicationRole\": \"None\",\r\n \"primaryServerId\": \"\",\r\n \"replicaCapacity\": 5\r\n },\r\n \"location\": \"koreasouth\",\r\n \"id\": \"/subscriptions/97181df2-909d-420b-ab93-1bff15acb6b7/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/servers/pgsdkserver\",\r\n \"name\": \"pgsdkserver\",\r\n \"type\": \"Microsoft.DBforPostgreSQL/servers\"\r\n}", "ResponseHeaders": { - "Content-Type": [ - "application/json; charset=utf-8" - ], - "Expires": [ - "-1" - ], "Cache-Control": [ "no-cache" ], - "Date": [ - "Thu, 29 Mar 2018 20:06:04 GMT" - ], "Pragma": [ "no-cache" ], - "Transfer-Encoding": [ - "chunked" + "x-ms-request-id": [ + "990b2df4-555f-4fb7-af75-c93d655e3ba7" ], "Server": [ "Microsoft-HTTPAPI/2.0" ], - "Vary": [ - "Accept-Encoding" - ], - "x-ms-request-id": [ - "99df443a-dc05-42a1-ba41-ee87a97105d1" - ], "x-ms-ratelimit-remaining-subscription-reads": [ - "14979" + "11996" ], "x-ms-correlation-request-id": [ - "601e42a0-6522-48f5-8340-d8f4a0229c0d" + "12ae3fdb-887a-404a-8cde-14bf469091c6" ], "x-ms-routing-request-id": [ - "WESTUS2:20180329T200605Z:601e42a0-6522-48f5-8340-d8f4a0229c0d" + "GERMANYWESTCENTRAL:20200911T174758Z:12ae3fdb-887a-404a-8cde-14bf469091c6" ], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], "X-Content-Type-Options": [ "nosniff" + ], + "Date": [ + "Fri, 11 Sep 2020 17:47:57 GMT" + ], + "Content-Length": [ + "900" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" ] }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"B_Gen5_1\",\r\n \"tier\": \"Basic\",\r\n \"family\": \"Gen5\",\r\n \"capacity\": 1\r\n },\r\n \"properties\": {\r\n \"administratorLogin\": \"testUser\",\r\n \"storageProfile\": {\r\n \"storageMB\": 5120,\r\n \"backupRetentionDays\": 7,\r\n \"geoRedundantBackup\": \"Disabled\",\r\n \"storageAutogrow\": \"Disabled\"\r\n },\r\n \"version\": \"9.6\",\r\n \"sslEnforcement\": \"Enabled\",\r\n \"minimalTlsVersion\": \"TLSEnforcementDisabled\",\r\n \"userVisibleState\": \"Ready\",\r\n \"fullyQualifiedDomainName\": \"pgsdkserver.postgres.database.azure.com\",\r\n \"earliestRestoreDate\": \"2020-09-11T20:55:55.513+03:00\",\r\n \"replicationRole\": \"None\",\r\n \"masterServerId\": \"\",\r\n \"replicaCapacity\": 5,\r\n \"byokEnforcement\": \"Disabled\",\r\n \"privateEndpointConnections\": [],\r\n \"infrastructureEncryption\": \"Disabled\",\r\n \"publicNetworkAccess\": \"Enabled\"\r\n },\r\n \"location\": \"eastus2euap\",\r\n \"id\": \"/subscriptions/7fec3109-5b78-4a24-b834-5d47d63e2596/resourceGroups/pgsdkrg/providers/Microsoft.DBforPostgreSQL/servers/pgsdkserver\",\r\n \"name\": \"pgsdkserver\",\r\n \"type\": \"Microsoft.DBforPostgreSQL/servers\"\r\n}", "StatusCode": 200 } ], "Names": {}, "Variables": { - "SubscriptionId": "97181df2-909d-420b-ab93-1bff15acb6b7" + "SubscriptionId": "7fec3109-5b78-4a24-b834-5d47d63e2596" } } \ No newline at end of file