From b9c002e695dcc8216d2d84bd733114499aa69d70 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Thu, 12 Mar 2020 03:09:50 +0000 Subject: [PATCH] Generated from 5423794943ca5a274d5db3fbcdfcf5d082b1eb30 Updating the review comments --- .../CheckNameAvailabilityOperations.cs | 17 +- .../src/Generated/ConfigurationsOperations.cs | 108 +- .../ConfigurationsOperationsExtensions.cs | 24 +- .../src/Generated/DatabasesOperations.cs | 146 +- .../DatabasesOperationsExtensions.cs | 36 +- .../src/Generated/FirewallRulesOperations.cs | 146 +- .../FirewallRulesOperationsExtensions.cs | 36 +- .../Generated/IConfigurationsOperations.cs | 16 +- .../src/Generated/IDatabasesOperations.cs | 24 +- .../src/Generated/IFirewallRulesOperations.cs | 24 +- .../src/Generated/ILogFilesOperations.cs | 4 +- .../Generated/IPostgreSQLManagementClient.cs | 22 +- .../IPrivateEndpointConnectionsOperations.cs | 276 ++++ .../IPrivateLinkResourcesOperations.cs | 102 ++ .../src/Generated/IReplicasOperations.cs | 4 +- .../IServerAdministratorsOperations.cs | 183 +++ .../IServerSecurityAlertPoliciesOperations.cs | 12 +- .../src/Generated/IServersOperations.cs | 40 +- .../IVirtualNetworkRulesOperations.cs | 24 +- .../LocationBasedPerformanceTierOperations.cs | 17 +- .../src/Generated/LogFilesOperations.cs | 35 +- .../Generated/LogFilesOperationsExtensions.cs | 6 +- .../Generated/Models/AzureEntityResource.cs | 59 + .../src/Generated/Models/Configuration.cs | 9 +- .../src/Generated/Models/Database.cs | 9 +- .../Generated/Models/ErrorAdditionalInfo.cs | 59 + .../src/Generated/Models/ErrorResponse.cs | 85 + .../src/Generated/Models/FirewallRule.cs | 9 +- .../src/Generated/Models/IdentityType.cs | 21 + .../Models/InfrastructureEncryption.cs | 22 + .../src/Generated/Models/LogFile.cs | 9 +- .../Generated/Models/MinimalTlsVersionEnum.cs | 24 + .../Models/PrivateEndpointConnection.cs | 93 ++ .../Models/PrivateEndpointProperty.cs | 50 + .../PrivateEndpointProvisioningState.cs | 25 + .../Generated/Models/PrivateLinkResource.cs | 59 + .../Models/PrivateLinkResourceProperties.cs | 64 + ...inkServiceConnectionStateActionsRequire.cs | 21 + ...ivateLinkServiceConnectionStateProperty.cs | 87 + ...PrivateLinkServiceConnectionStateStatus.cs | 24 + .../src/Generated/Models/ProxyResource.cs | 39 +- .../Models/PublicNetworkAccessEnum.cs | 22 + .../src/Generated/Models/Resource.cs | 72 + .../src/Generated/Models/ResourceIdentity.cs | 75 + .../src/Generated/Models/Server.cs | 103 +- .../Models/ServerAdministratorResource.cs | 107 ++ .../Models/ServerPrivateEndpointConnection.cs | 76 + ...rverPrivateEndpointConnectionProperties.cs | 87 + ...ivateLinkServiceConnectionStateProperty.cs | 90 ++ .../Models/ServerPropertiesForCreate.cs | 18 +- .../ServerPropertiesForDefaultCreate.cs | 9 +- .../Models/ServerPropertiesForGeoRestore.cs | 9 +- .../Models/ServerPropertiesForReplica.cs | 9 +- .../Models/ServerPropertiesForRestore.cs | 9 +- .../Models/ServerSecurityAlertPolicy.cs | 9 +- .../src/Generated/Models/ServerState.cs | 1 + .../Models/ServerUpdateParameters.cs | 18 +- .../src/Generated/Models/ServerVersion.cs | 1 + .../src/Generated/Models/StorageAutogrow.cs | 22 + .../src/Generated/Models/StorageProfile.cs | 12 +- .../src/Generated/Models/TagsObject.cs | 53 + .../src/Generated/Models/TrackedResource.cs | 35 +- .../Generated/Models/VirtualNetworkRule.cs | 9 +- .../src/Generated/Operations.cs | 16 +- .../Generated/PostgreSQLManagementClient.cs | 26 +- .../PrivateEndpointConnectionsOperations.cs | 1435 +++++++++++++++++ ...EndpointConnectionsOperationsExtensions.cs | 439 +++++ .../PrivateLinkResourcesOperations.cs | 668 ++++++++ ...rivateLinkResourcesOperationsExtensions.cs | 145 ++ .../src/Generated/ReplicasOperations.cs | 35 +- .../Generated/ReplicasOperationsExtensions.cs | 6 +- .../SdkInfo_PostgreSQLManagementClient.cs | 3 + .../ServerAdministratorsOperations.cs | 984 +++++++++++ ...erverAdministratorsOperationsExtensions.cs | 281 ++++ .../ServerSecurityAlertPoliciesOperations.cs | 65 +- ...curityAlertPoliciesOperationsExtensions.cs | 18 +- .../src/Generated/ServersOperations.cs | 239 ++- .../Generated/ServersOperationsExtensions.cs | 60 +- .../VirtualNetworkRulesOperations.cs | 130 +- ...VirtualNetworkRulesOperationsExtensions.cs | 36 +- 80 files changed, 6892 insertions(+), 610 deletions(-) create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IPrivateEndpointConnectionsOperations.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IPrivateLinkResourcesOperations.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IServerAdministratorsOperations.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/AzureEntityResource.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ErrorAdditionalInfo.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ErrorResponse.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/IdentityType.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/InfrastructureEncryption.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/MinimalTlsVersionEnum.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PrivateEndpointConnection.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PrivateEndpointProperty.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PrivateEndpointProvisioningState.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PrivateLinkResource.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PrivateLinkResourceProperties.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PrivateLinkServiceConnectionStateActionsRequire.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PrivateLinkServiceConnectionStateStatus.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PublicNetworkAccessEnum.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Resource.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ResourceIdentity.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerAdministratorResource.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPrivateEndpointConnection.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPrivateEndpointConnectionProperties.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPrivateLinkServiceConnectionStateProperty.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/StorageAutogrow.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/TagsObject.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/PrivateEndpointConnectionsOperations.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/PrivateLinkResourcesOperations.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/PrivateLinkResourcesOperationsExtensions.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerAdministratorsOperations.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerAdministratorsOperationsExtensions.cs diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/CheckNameAvailabilityOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/CheckNameAvailabilityOperations.cs index 05f96f4f27b5..bfa2c1277793 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/CheckNameAvailabilityOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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,6 +106,7 @@ 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); @@ -111,9 +116,9 @@ internal CheckNameAvailabilityOperations(PostgreSQLManagementClient client) 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/ConfigurationsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ConfigurationsOperations.cs index a28796d07795..1b401fdab9de 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ConfigurationsOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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); @@ -156,9 +174,9 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) _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); @@ -353,9 +390,9 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) _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); @@ -567,9 +623,9 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) _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/Generated/ConfigurationsOperationsExtensions.cs index 286754474789..baa28212f649 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ConfigurationsOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/DatabasesOperations.cs index be297d9d571a..bcb7a698afef 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/DatabasesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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); @@ -182,9 +199,9 @@ internal DatabasesOperations(PostgreSQLManagementClient client) _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); @@ -379,9 +415,9 @@ internal DatabasesOperations(PostgreSQLManagementClient client) _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); @@ -593,9 +648,9 @@ internal DatabasesOperations(PostgreSQLManagementClient client) _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); @@ -820,9 +894,9 @@ internal DatabasesOperations(PostgreSQLManagementClient client) _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/Generated/DatabasesOperationsExtensions.cs index eb413e9f87d6..f3a1a5e17b8b 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/DatabasesOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/FirewallRulesOperations.cs index 3c2b301597c9..ce3927fb56cc 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/FirewallRulesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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); @@ -182,9 +199,9 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) _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); @@ -379,9 +415,9 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) _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); @@ -597,9 +652,9 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) _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); @@ -824,9 +898,9 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) _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/Generated/FirewallRulesOperationsExtensions.cs index a510a677024f..e8caebc5390f 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/FirewallRulesOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/IConfigurationsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IConfigurationsOperations.cs index 7ef80e7971f9..3aa376678555 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IConfigurationsOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/IDatabasesOperations.cs index 0d733ac50ff3..51caa9ffa029 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IDatabasesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/IFirewallRulesOperations.cs index 7101fab1cf80..b7d0052b84ba 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IFirewallRulesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/ILogFilesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ILogFilesOperations.cs index 2c84402fe14e..86dce1f84e0d 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ILogFilesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/IPostgreSQLManagementClient.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IPostgreSQLManagementClient.cs index 5b49358512be..ea947e39db21 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IPostgreSQLManagementClient.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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. /// @@ -127,5 +127,15 @@ public partial interface IPostgreSQLManagementClient : System.IDisposable /// IOperations Operations { get; } + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } + + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + IPrivateLinkResourcesOperations PrivateLinkResources { get; } + } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IPrivateEndpointConnectionsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IPrivateEndpointConnectionsOperations.cs new file mode 100644 index 000000000000..f08e2ede0a8e --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/IPrivateLinkResourcesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IPrivateLinkResourcesOperations.cs new file mode 100644 index 000000000000..1f1943b06c37 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/IReplicasOperations.cs index ab17e45748a3..9a64ff3150b6 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IReplicasOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/IServerAdministratorsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IServerAdministratorsOperations.cs new file mode 100644 index 000000000000..1e3c61b5a9db --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/IServerSecurityAlertPoliciesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IServerSecurityAlertPoliciesOperations.cs index fcb33f3308c6..cdfb5c56c6a9 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IServerSecurityAlertPoliciesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/IServersOperations.cs index 7d3c9ace6d57..8d164f836cfc 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IServersOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/IVirtualNetworkRulesOperations.cs index de6ab786ebbf..379c985193de 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IVirtualNetworkRulesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/LocationBasedPerformanceTierOperations.cs index 1e532b64a474..a00c9acb70c2 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LocationBasedPerformanceTierOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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,6 +103,7 @@ 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); @@ -109,9 +114,9 @@ internal LocationBasedPerformanceTierOperations(PostgreSQLManagementClient clien _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/LogFilesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LogFilesOperations.cs index 2c03293c34e7..04d3d37f49d2 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LogFilesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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); @@ -118,9 +137,9 @@ internal LogFilesOperations(PostgreSQLManagementClient client) _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/Generated/LogFilesOperationsExtensions.cs index 17f489ccaec0..53640a18d0b3 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LogFilesOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/AzureEntityResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/AzureEntityResource.cs new file mode 100644 index 000000000000..f2a5a62dd650 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/Configuration.cs index 8f040f9393cf..e41b79330b4b 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Configuration.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/Database.cs index a62cddc775c7..b27e69c298d5 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Database.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/ErrorAdditionalInfo.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 000000000000..e14d43ba9060 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/ErrorResponse.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..83a64fe68701 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/FirewallRule.cs index 607d1e43dd9d..5603a81676a6 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/FirewallRule.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/IdentityType.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/IdentityType.cs new file mode 100644 index 000000000000..7825c32e71e4 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/InfrastructureEncryption.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/InfrastructureEncryption.cs new file mode 100644 index 000000000000..73c447b730b6 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/InfrastructureEncryption.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 InfrastructureEncryption. + /// + public static class InfrastructureEncryption + { + public const string Enabled = "Enabled"; + 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/Generated/Models/LogFile.cs index a536fd9f5e8b..f2d928126710 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/LogFile.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/MinimalTlsVersionEnum.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/MinimalTlsVersionEnum.cs new file mode 100644 index 000000000000..2652830dff36 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/PrivateEndpointConnection.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PrivateEndpointConnection.cs new file mode 100644 index 000000000000..d0f5e74f37c6 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/PrivateEndpointProperty.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PrivateEndpointProperty.cs new file mode 100644 index 000000000000..505e7303626e --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/PrivateEndpointProvisioningState.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PrivateEndpointProvisioningState.cs new file mode 100644 index 000000000000..f00516eae044 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/PrivateLinkResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PrivateLinkResource.cs new file mode 100644 index 000000000000..d6071c15d6c7 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/PrivateLinkResourceProperties.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PrivateLinkResourceProperties.cs new file mode 100644 index 000000000000..6760ae16c1ce --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/PrivateLinkServiceConnectionStateActionsRequire.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PrivateLinkServiceConnectionStateActionsRequire.cs new file mode 100644 index 000000000000..e1620432e527 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs new file mode 100644 index 000000000000..feab0c488c4c --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/PrivateLinkServiceConnectionStateStatus.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PrivateLinkServiceConnectionStateStatus.cs new file mode 100644 index 000000000000..c9992315e6d0 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/ProxyResource.cs index 6b8b2bda7980..221808691947 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ProxyResource.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/PublicNetworkAccessEnum.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/PublicNetworkAccessEnum.cs new file mode 100644 index 000000000000..304db450b0c4 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/Resource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Resource.cs new file mode 100644 index 000000000000..00ee8d855eb5 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/ResourceIdentity.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ResourceIdentity.cs new file mode 100644 index 000000000000..01acfc21d827 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/Server.cs index d957bbfe887d..3f4ca9eaba66 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Server.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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 endpoint + /// 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 endpoint 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/Generated/Models/ServerAdministratorResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerAdministratorResource.cs new file mode 100644 index 000000000000..c410cd4202db --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/ServerPrivateEndpointConnection.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPrivateEndpointConnection.cs new file mode 100644 index 000000000000..b711754ebf94 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/ServerPrivateEndpointConnectionProperties.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPrivateEndpointConnectionProperties.cs new file mode 100644 index 000000000000..915658ad2375 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/ServerPrivateLinkServiceConnectionStateProperty.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPrivateLinkServiceConnectionStateProperty.cs new file mode 100644 index 000000000000..fe0849058efd --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/ServerPropertiesForCreate.cs index a88781652d68..fc9b76920369 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForCreate.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForCreate.cs @@ -30,15 +30,19 @@ 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' /// 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), StorageProfile storageProfile = default(StorageProfile)) { Version = version; SslEnforcement = sslEnforcement; + MinimalTlsVersion = minimalTlsVersion; StorageProfile = storageProfile; CustomInit(); } @@ -50,7 +54,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 +66,14 @@ 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 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/Generated/Models/ServerPropertiesForDefaultCreate.cs index e53f9da95499..6de8a94060e6 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForDefaultCreate.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForDefaultCreate.cs @@ -39,13 +39,16 @@ 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' /// 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), StorageProfile storageProfile = default(StorageProfile)) + : base(version, sslEnforcement, minimalTlsVersion, 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/Generated/Models/ServerPropertiesForGeoRestore.cs index 95e48dfb3a82..135e26168cd0 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForGeoRestore.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForGeoRestore.cs @@ -37,13 +37,16 @@ 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' /// 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), StorageProfile storageProfile = default(StorageProfile)) + : base(version, sslEnforcement, minimalTlsVersion, 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/Generated/Models/ServerPropertiesForReplica.cs index 994f08f9b9e6..8662f1a33d5e 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForReplica.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForReplica.cs @@ -34,13 +34,16 @@ 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' /// 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), StorageProfile storageProfile = default(StorageProfile)) + : base(version, sslEnforcement, minimalTlsVersion, 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/Generated/Models/ServerPropertiesForRestore.cs index 534c4017d197..9d5c8489aaee 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForRestore.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForRestore.cs @@ -36,13 +36,16 @@ 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' /// 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), StorageProfile storageProfile = default(StorageProfile)) + : base(version, sslEnforcement, minimalTlsVersion, 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/Generated/Models/ServerSecurityAlertPolicy.cs index c6c4368fc399..06b616df3135 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerSecurityAlertPolicy.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/ServerState.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerState.cs index a3b2bf28dbb4..024c8530e8bf 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerState.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/ServerUpdateParameters.cs index 125c70a21b09..44ed89785989 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerUpdateParameters.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerUpdateParameters.cs @@ -39,21 +39,25 @@ public ServerUpdateParameters() /// 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' /// 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(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 replicationRole = default(string), IDictionary tags = default(IDictionary)) { Sku = sku; StorageProfile = storageProfile; AdministratorLoginPassword = administratorLoginPassword; Version = version; SslEnforcement = sslEnforcement; + MinimalTlsVersion = minimalTlsVersion; ReplicationRole = replicationRole; Tags = tags; CustomInit(); @@ -84,7 +88,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 +100,14 @@ 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 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/Generated/Models/ServerVersion.cs index 7b9d6a2352fb..195c933c4628 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerVersion.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/StorageAutogrow.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/StorageAutogrow.cs new file mode 100644 index 000000000000..4fb501782f93 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/StorageProfile.cs index e4b5fa78e581..568db7f42c3b 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/StorageProfile.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/TagsObject.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/TagsObject.cs new file mode 100644 index 000000000000..b1b7e3cfab0a --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/TrackedResource.cs index 4231b126e6c8..f76bdf2825ec 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/TrackedResource.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/Models/VirtualNetworkRule.cs index 8f132417371e..cffba1a1967d 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/VirtualNetworkRule.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Operations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Operations.cs index 495944e1f5b5..30669546ec34 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Operations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Operations.cs @@ -65,21 +65,12 @@ internal Operations(PostgreSQLManagementClient client) /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// /// /// A response object containing the response body and response headers. /// public async Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -87,6 +78,7 @@ internal Operations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -94,9 +86,9 @@ internal Operations(PostgreSQLManagementClient client) 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 (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/PostgreSQLManagementClient.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/PostgreSQLManagementClient.cs index 8354f1114cdc..a8caa46564e7 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/PostgreSQLManagementClient.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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. /// @@ -132,6 +132,16 @@ public partial class PostgreSQLManagementClient : ServiceClient public virtual IOperations Operations { get; private set; } + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } + + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } + /// /// Initializes a new instance of the PostgreSQLManagementClient class. /// @@ -380,12 +390,14 @@ 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); + PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); + PrivateLinkResources = new PrivateLinkResourcesOperations(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/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/PrivateEndpointConnectionsOperations.cs new file mode 100644 index 000000000000..ce6bec612f89 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/PrivateEndpointConnectionsOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs new file mode 100644 index 000000000000..2d26956c7dc8 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/PrivateLinkResourcesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/PrivateLinkResourcesOperations.cs new file mode 100644 index 000000000000..39f329b8db20 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/PrivateLinkResourcesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/PrivateLinkResourcesOperationsExtensions.cs new file mode 100644 index 000000000000..e274e4b97ab0 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/ReplicasOperations.cs index 15c6e3d417ea..f66dc6f04dfb 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ReplicasOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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); @@ -118,9 +137,9 @@ internal ReplicasOperations(PostgreSQLManagementClient client) _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/Generated/ReplicasOperationsExtensions.cs index fa54cfe93b2f..6e80270ae710 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ReplicasOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/SdkInfo_PostgreSQLManagementClient.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/SdkInfo_PostgreSQLManagementClient.cs index de96637c193f..de3c953fbc34 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/SdkInfo_PostgreSQLManagementClient.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/SdkInfo_PostgreSQLManagementClient.cs @@ -26,7 +26,10 @@ public static IEnumerable> ApiInfo_PostgreSQLManag new Tuple("DBforPostgreSQL", "LocationBasedPerformanceTier", "2017-12-01"), new Tuple("DBforPostgreSQL", "LogFiles", "2017-12-01"), new Tuple("DBforPostgreSQL", "Operations", "2017-12-01"), + new Tuple("DBforPostgreSQL", "PrivateEndpointConnections", "2018-06-01"), + new Tuple("DBforPostgreSQL", "PrivateLinkResources", "2018-06-01"), new Tuple("DBforPostgreSQL", "Replicas", "2017-12-01"), + new Tuple("DBforPostgreSQL", "ServerAdministrators", "2017-12-01"), new Tuple("DBforPostgreSQL", "ServerSecurityAlertPolicies", "2017-12-01"), new Tuple("DBforPostgreSQL", "Servers", "2017-12-01"), new Tuple("DBforPostgreSQL", "VirtualNetworkRules", "2017-12-01"), diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerAdministratorsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerAdministratorsOperations.cs new file mode 100644 index 000000000000..9a9a3009c54c --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/ServerAdministratorsOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerAdministratorsOperationsExtensions.cs new file mode 100644 index 000000000000..e8d55f93089c --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/ServerSecurityAlertPoliciesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerSecurityAlertPoliciesOperations.cs index a2c21dec6ed0..37e18c157e87 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerSecurityAlertPoliciesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/ServerSecurityAlertPoliciesOperationsExtensions.cs index 2275799343f6..fa076ed76475 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerSecurityAlertPoliciesOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/ServersOperations.cs index c26fccb207aa..90a4cf4fafbd 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServersOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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); @@ -194,9 +210,9 @@ internal ServersOperations(PostgreSQLManagementClient client) _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,6 +406,7 @@ 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); @@ -382,9 +417,9 @@ internal ServersOperations(PostgreSQLManagementClient client) _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,6 +591,7 @@ 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); } @@ -560,9 +600,9 @@ internal ServersOperations(PostgreSQLManagementClient client) 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); @@ -792,9 +850,9 @@ internal ServersOperations(PostgreSQLManagementClient client) _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); @@ -1022,9 +1099,9 @@ internal ServersOperations(PostgreSQLManagementClient client) _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); @@ -1222,9 +1318,9 @@ internal ServersOperations(PostgreSQLManagementClient client) _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); @@ -1398,9 +1513,9 @@ internal ServersOperations(PostgreSQLManagementClient client) _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/Generated/ServersOperationsExtensions.cs index 66e13411c10a..c3e2c002f68e 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServersOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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/Generated/VirtualNetworkRulesOperations.cs index 3a7050e30386..7d9b7d9d06a9 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/VirtualNetworkRulesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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,6 +133,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("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); @@ -127,9 +146,9 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) _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,6 +404,7 @@ 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); } @@ -379,9 +415,9 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) _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); @@ -597,9 +652,9 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) _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,6 +886,7 @@ 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); } @@ -824,9 +898,9 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) _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/Generated/VirtualNetworkRulesOperationsExtensions.cs index 85a0537b7116..7187020c0145 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/VirtualNetworkRulesOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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.