From 2e3726b01700a7cae237ca9b569ab1c088d67611 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Mon, 14 Sep 2020 06:36:05 +0000 Subject: [PATCH] Generated from 1b5edee19d240ffefbc58c741738fd88d138c821 --- .../CheckNameAvailabilityOperations.cs | 19 +- .../src/Generated/ConfigurationsOperations.cs | 114 +- .../ConfigurationsOperationsExtensions.cs | 24 +- .../src/Generated/DatabasesOperations.cs | 154 +- .../DatabasesOperationsExtensions.cs | 36 +- .../src/Generated/FirewallRulesOperations.cs | 154 +- .../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 | 31 +- .../IPrivateEndpointConnectionsOperations.cs | 276 ++++ .../IPrivateLinkResourcesOperations.cs | 102 ++ .../src/Generated/IReplicasOperations.cs | 4 +- .../IServerAdministratorsOperations.cs | 183 +++ .../src/Generated/IServerKeysOperations.cs | 216 +++ .../IServerSecurityAlertPoliciesOperations.cs | 12 +- .../src/Generated/IServersOperations.cs | 40 +- .../IVirtualNetworkRulesOperations.cs | 24 +- .../LocationBasedPerformanceTierOperations.cs | 19 +- .../src/Generated/LogFilesOperations.cs | 37 +- .../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 | 28 + .../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 ++ .../src/Generated/Models/ServerForCreate.cs | 11 +- .../src/Generated/Models/ServerKey.cs | 91 ++ .../Models/ServerPrivateEndpointConnection.cs | 76 + ...rverPrivateEndpointConnectionProperties.cs | 87 + ...ivateLinkServiceConnectionStateProperty.cs | 90 ++ .../Models/ServerPropertiesForCreate.cs | 43 +- .../ServerPropertiesForDefaultCreate.cs | 16 +- .../Models/ServerPropertiesForGeoRestore.cs | 16 +- .../Models/ServerPropertiesForReplica.cs | 16 +- .../Models/ServerPropertiesForRestore.cs | 16 +- .../Models/ServerSecurityAlertPolicy.cs | 9 +- .../src/Generated/Models/ServerState.cs | 1 + .../Models/ServerUpdateParameters.cs | 40 +- .../src/Generated/Models/ServerVersion.cs | 1 + .../src/Generated/Models/Sku.cs | 6 +- .../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 | 18 +- .../Generated/PostgreSQLManagementClient.cs | 38 +- .../PrivateEndpointConnectionsOperations.cs | 1435 +++++++++++++++++ ...EndpointConnectionsOperationsExtensions.cs | 439 +++++ .../PrivateLinkResourcesOperations.cs | 668 ++++++++ ...rivateLinkResourcesOperationsExtensions.cs | 145 ++ .../src/Generated/ReplicasOperations.cs | 37 +- .../Generated/ReplicasOperationsExtensions.cs | 6 +- .../SdkInfo_PostgreSQLManagementClient.cs | 24 +- .../ServerAdministratorsOperations.cs | 984 +++++++++++ ...erverAdministratorsOperationsExtensions.cs | 281 ++++ .../src/Generated/ServerKeysOperations.cs | 1184 ++++++++++++++ .../ServerKeysOperationsExtensions.cs | 339 ++++ .../ServerSecurityAlertPoliciesOperations.cs | 65 +- ...curityAlertPoliciesOperationsExtensions.cs | 18 +- .../src/Generated/ServersOperations.cs | 253 ++- .../Generated/ServersOperationsExtensions.cs | 60 +- .../VirtualNetworkRulesOperations.cs | 138 +- ...VirtualNetworkRulesOperationsExtensions.cs | 36 +- 86 files changed, 8872 insertions(+), 654 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/IServerKeysOperations.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/ServerKey.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 create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerKeysOperations.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerKeysOperationsExtensions.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 05f96f4f27b53..28c3e6068754a 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,18 +106,19 @@ internal CheckNameAvailabilityOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("nameAvailabilityRequest", nameAvailabilityRequest); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Execute", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DBForPostgreSQL/checkNameAvailability").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ConfigurationsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ConfigurationsOperations.cs index a28796d077951..68cafb36067b4 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ConfigurationsOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ConfigurationsOperations.cs @@ -54,8 +54,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) /// Updates a configuration of a server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -83,8 +82,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) /// Gets information about a configuration of server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -115,18 +113,36 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) /// public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string configurationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (serverName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); @@ -135,6 +151,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "configurationName"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -142,6 +159,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("configurationName", configurationName); @@ -150,15 +168,15 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/configurations/{configurationName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{configurationName}", System.Uri.EscapeDataString(configurationName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -289,8 +307,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) /// List all the configurations in a given server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -318,22 +335,41 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) /// public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (serverName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -341,6 +377,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -348,14 +385,14 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/configurations").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -486,8 +523,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) /// Updates a configuration of a server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -521,18 +557,36 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) /// public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string configurationName, Configuration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (serverName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); @@ -545,6 +599,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -552,6 +607,7 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("configurationName", configurationName); @@ -561,15 +617,15 @@ internal ConfigurationsOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/configurations/{configurationName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{configurationName}", System.Uri.EscapeDataString(configurationName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ConfigurationsOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ConfigurationsOperationsExtensions.cs index 2867544747893..baa28212f6495 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ConfigurationsOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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 be297d9d571a1..288e2cf275ea9 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); @@ -176,15 +193,15 @@ internal DatabasesOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/databases/{databaseName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -315,8 +332,7 @@ internal DatabasesOperations(PostgreSQLManagementClient client) /// List all the databases in a given server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -344,22 +360,41 @@ internal DatabasesOperations(PostgreSQLManagementClient client) /// public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (serverName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -367,6 +402,7 @@ internal DatabasesOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -374,14 +410,14 @@ internal DatabasesOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/databases").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -512,8 +548,7 @@ internal DatabasesOperations(PostgreSQLManagementClient client) /// Creates a new database or updates an existing database. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -547,18 +582,36 @@ internal DatabasesOperations(PostgreSQLManagementClient client) /// public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (serverName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); @@ -571,6 +624,7 @@ internal DatabasesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -578,6 +632,7 @@ internal DatabasesOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); @@ -587,15 +642,15 @@ internal DatabasesOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/databases/{databaseName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -750,8 +805,7 @@ internal DatabasesOperations(PostgreSQLManagementClient client) /// Deletes a database. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -779,18 +833,36 @@ internal DatabasesOperations(PostgreSQLManagementClient client) /// public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (serverName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); @@ -799,6 +871,7 @@ internal DatabasesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -806,6 +879,7 @@ internal DatabasesOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("databaseName", databaseName); @@ -814,15 +888,15 @@ internal DatabasesOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/databases/{databaseName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/DatabasesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/DatabasesOperationsExtensions.cs index eb413e9f87d67..f3a1a5e17b8b2 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/DatabasesOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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 3c2b301597c9f..a3dc237bccb0a 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); @@ -176,15 +193,15 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -315,8 +332,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) /// List all the firewall rules in a given server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -344,22 +360,41 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) /// public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (serverName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -367,6 +402,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -374,14 +410,14 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/firewallRules").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -512,8 +548,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) /// Creates a new firewall rule or updates an existing firewall rule. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -547,18 +582,36 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) /// public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, FirewallRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (serverName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); @@ -575,6 +628,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) { parameters.Validate(); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -582,6 +636,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("firewallRuleName", firewallRuleName); @@ -591,15 +646,15 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -754,8 +809,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) /// Deletes a server firewall rule. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -783,18 +837,36 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) /// public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (serverName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); @@ -803,6 +875,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -810,6 +883,7 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("firewallRuleName", firewallRuleName); @@ -818,15 +892,15 @@ internal FirewallRulesOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/FirewallRulesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/FirewallRulesOperationsExtensions.cs index a510a677024f7..e8caebc5390f1 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/FirewallRulesOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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 7ef80e7971f9f..3aa3766785555 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 0d733ac50ff34..51caa9ffa029c 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 7101fab1cf807..b7d0052b84ba0 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 2c84402fe14e7..86dce1f84e0d9 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 5b49358512be0..6735268b4da60 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. /// @@ -117,15 +117,30 @@ public partial interface IPostgreSQLManagementClient : System.IDisposable /// ICheckNameAvailabilityOperations CheckNameAvailability { get; } + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + /// /// Gets the IServerSecurityAlertPoliciesOperations. /// IServerSecurityAlertPoliciesOperations ServerSecurityAlertPolicies { get; } /// - /// Gets the IOperations. + /// Gets the IPrivateEndpointConnectionsOperations. /// - IOperations Operations { get; } + IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } + + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + IPrivateLinkResourcesOperations PrivateLinkResources { get; } + + /// + /// Gets the IServerKeysOperations. + /// + IServerKeysOperations ServerKeys { get; } } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IPrivateEndpointConnectionsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IPrivateEndpointConnectionsOperations.cs new file mode 100644 index 0000000000000..f08e2ede0a8e2 --- /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 0000000000000..1f1943b06c37d --- /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 ab17e45748a35..9a64ff3150b60 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 0000000000000..1e3c61b5a9dbd --- /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/IServerKeysOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IServerKeysOperations.cs new file mode 100644 index 0000000000000..d7eb0a9635f4f --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IServerKeysOperations.cs @@ -0,0 +1,216 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ServerKeysOperations operations. + /// + public partial interface IServerKeysOperations + { + /// + /// Gets a list of Server keys. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a PostgreSQL Server key. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be retrieved. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string keyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a PostgreSQL Server key. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be operated on (updated or + /// created). + /// + /// + /// The requested PostgreSQL Server key resource state. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string serverName, string keyName, ServerKey parameters, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the PostgreSQL Server key with the given name. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be deleted. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string serverName, string keyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a PostgreSQL Server key. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be operated on (updated or + /// created). + /// + /// + /// The requested PostgreSQL Server key resource state. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string serverName, string keyName, ServerKey parameters, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the PostgreSQL Server key with the given name. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be deleted. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string serverName, string keyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of Server keys. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IServerSecurityAlertPoliciesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IServerSecurityAlertPoliciesOperations.cs index fcb33f3308c61..cdfb5c56c6a9d 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/IServerSecurityAlertPoliciesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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 7d3c9ace6d574..8d164f836cfc8 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 de6ab786ebbf9..379c985193de5 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 1e532b64a474a..5c0729a036d4a 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,19 +103,20 @@ internal LocationBasedPerformanceTierOperations(PostgreSQLManagementClient clien { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("locationName", locationName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/performanceTiers").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DBForPostgreSQL/locations/{locationName}/performanceTiers").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LogFilesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LogFilesOperations.cs index 2c03293c34e7f..ba9fb0c480cd1 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LogFilesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LogFilesOperations.cs @@ -54,8 +54,7 @@ internal LogFilesOperations(PostgreSQLManagementClient client) /// List all the log files in a given server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -83,22 +82,41 @@ internal LogFilesOperations(PostgreSQLManagementClient client) /// public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (serverName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -106,6 +124,7 @@ internal LogFilesOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -113,14 +132,14 @@ internal LogFilesOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/logFiles").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/logFiles").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LogFilesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LogFilesOperationsExtensions.cs index 17f489ccaec0b..53640a18d0b3c 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/LogFilesOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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 0000000000000..f2a5a62dd650d --- /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 8f040f9393cf8..e41b79330b4b9 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 a62cddc775c70..b27e69c298d5a 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 0000000000000..e14d43ba90608 --- /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 0000000000000..83a64fe687016 --- /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 607d1e43dd9d4..5603a81676a6c 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 0000000000000..7825c32e71e4a --- /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 0000000000000..90aed8cf0982d --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/InfrastructureEncryption.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.Models +{ + + /// + /// Defines values for InfrastructureEncryption. + /// + public static class InfrastructureEncryption + { + /// + /// Default value for single layer of encryption for data at rest. + /// + public const string Enabled = "Enabled"; + /// + /// Additional (2nd) layer of encryption for data at rest + /// + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/LogFile.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/LogFile.cs index a536fd9f5e8bd..f2d928126710c 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/LogFile.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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 0000000000000..2652830dff36b --- /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 0000000000000..d0f5e74f37c6b --- /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 0000000000000..505e7303626ef --- /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 0000000000000..f00516eae0445 --- /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 0000000000000..d6071c15d6c7e --- /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 0000000000000..6760ae16c1ced --- /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 0000000000000..e1620432e5279 --- /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 0000000000000..feab0c488c4c6 --- /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 0000000000000..c9992315e6d06 --- /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 6b8b2bda7980e..2218086919479 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 0000000000000..304db450b0c41 --- /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 0000000000000..00ee8d855eb5e --- /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 0000000000000..01acfc21d8273 --- /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 d957bbfe887d6..5cb4f611fe041 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 network + /// access is allowed for this server. Value is optional but if passed + /// in, must be 'Enabled' or 'Disabled'. Possible values include: + /// 'Enabled', 'Disabled' + /// List of private endpoint + /// connections on a server + public Server(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ResourceIdentity identity = default(ResourceIdentity), Sku sku = default(Sku), string administratorLogin = default(string), string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), string minimalTlsVersion = default(string), string byokEnforcement = default(string), string infrastructureEncryption = default(string), string userVisibleState = default(string), string fullyQualifiedDomainName = default(string), System.DateTime? earliestRestoreDate = default(System.DateTime?), StorageProfile storageProfile = default(StorageProfile), string replicationRole = default(string), string masterServerId = default(string), int? replicaCapacity = default(int?), string publicNetworkAccess = default(string), IList privateEndpointConnections = default(IList)) : base(location, id, name, type, tags) { + Identity = identity; Sku = sku; AdministratorLogin = administratorLogin; Version = version; SslEnforcement = sslEnforcement; + MinimalTlsVersion = minimalTlsVersion; + ByokEnforcement = byokEnforcement; + InfrastructureEncryption = infrastructureEncryption; UserVisibleState = userVisibleState; FullyQualifiedDomainName = fullyQualifiedDomainName; EarliestRestoreDate = earliestRestoreDate; @@ -78,6 +100,8 @@ public Server() ReplicationRole = replicationRole; MasterServerId = masterServerId; ReplicaCapacity = replicaCapacity; + PublicNetworkAccess = publicNetworkAccess; + PrivateEndpointConnections = privateEndpointConnections; CustomInit(); } @@ -86,6 +110,12 @@ public Server() /// partial void CustomInit(); + /// + /// Gets or sets the Azure Active Directory identity of the server. + /// + [JsonProperty(PropertyName = "identity")] + public ResourceIdentity Identity { get; set; } + /// /// Gets or sets the SKU (pricing tier) of the server. /// @@ -102,7 +132,7 @@ public Server() /// /// Gets or sets server version. Possible values include: '9.5', '9.6', - /// '10', '10.0', '10.2' + /// '10', '10.0', '10.2', '11' /// [JsonProperty(PropertyName = "properties.version")] public string Version { get; set; } @@ -114,9 +144,32 @@ public Server() [JsonProperty(PropertyName = "properties.sslEnforcement")] public SslEnforcementEnum? SslEnforcement { get; set; } + /// + /// Gets or sets enforce a minimal Tls version for the server. Possible + /// values include: 'TLS1_0', 'TLS1_1', 'TLS1_2', + /// 'TLSEnforcementDisabled' + /// + [JsonProperty(PropertyName = "properties.minimalTlsVersion")] + public string MinimalTlsVersion { get; set; } + + /// + /// Gets status showing whether the server data encryption is enabled + /// with customer-managed keys. + /// + [JsonProperty(PropertyName = "properties.byokEnforcement")] + public string ByokEnforcement { get; private set; } + + /// + /// Gets or sets status showing whether the server enabled + /// infrastructure encryption. Possible values include: 'Enabled', + /// 'Disabled' + /// + [JsonProperty(PropertyName = "properties.infrastructureEncryption")] + public string InfrastructureEncryption { get; set; } + /// /// Gets or sets a state of a server that is visible to user. Possible - /// values include: 'Ready', 'Dropping', 'Disabled' + /// values include: 'Ready', 'Dropping', 'Disabled', 'Inaccessible' /// [JsonProperty(PropertyName = "properties.userVisibleState")] public string UserVisibleState { get; set; } @@ -158,6 +211,20 @@ public Server() [JsonProperty(PropertyName = "properties.replicaCapacity")] public int? ReplicaCapacity { get; set; } + /// + /// Gets or sets whether or not public network access is allowed for + /// this server. Value is optional but if passed in, must be 'Enabled' + /// or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + + /// + /// Gets list of private endpoint connections on a server + /// + [JsonProperty(PropertyName = "properties.privateEndpointConnections")] + public IList PrivateEndpointConnections { get; private set; } + /// /// Validate the object. /// @@ -175,6 +242,16 @@ public override void Validate() { throw new ValidationException(ValidationRules.InclusiveMinimum, "ReplicaCapacity", 0); } + if (PrivateEndpointConnections != null) + { + foreach (var element in PrivateEndpointConnections) + { + if (element != null) + { + element.Validate(); + } + } + } } } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerAdministratorResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerAdministratorResource.cs new file mode 100644 index 0000000000000..c410cd4202dbc --- /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/ServerForCreate.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerForCreate.cs index 9b7ee4c4a4b58..78a7a2a70fbac 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerForCreate.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerForCreate.cs @@ -35,11 +35,14 @@ public ServerForCreate() /// Properties of the server. /// The location the resource resides /// in. + /// The Azure Active Directory identity of the + /// server. /// The SKU (pricing tier) of the server. /// Application-specific metadata in the form of /// key-value pairs. - public ServerForCreate(ServerPropertiesForCreate properties, string location, Sku sku = default(Sku), IDictionary tags = default(IDictionary)) + public ServerForCreate(ServerPropertiesForCreate properties, string location, ResourceIdentity identity = default(ResourceIdentity), Sku sku = default(Sku), IDictionary tags = default(IDictionary)) { + Identity = identity; Sku = sku; Properties = properties; Location = location; @@ -52,6 +55,12 @@ public ServerForCreate() /// partial void CustomInit(); + /// + /// Gets or sets the Azure Active Directory identity of the server. + /// + [JsonProperty(PropertyName = "identity")] + public ResourceIdentity Identity { get; set; } + /// /// Gets or sets the SKU (pricing tier) of the server. /// diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerKey.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerKey.cs new file mode 100644 index 0000000000000..113635eb5fd6a --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerKey.cs @@ -0,0 +1,91 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A PostgreSQL Server key. + /// + [Rest.Serialization.JsonTransformation] + public partial class ServerKey : ProxyResource + { + /// + /// Initializes a new instance of the ServerKey class. + /// + public ServerKey() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServerKey class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Kind of encryption protector used to protect the + /// key. + /// The URI of the key. + /// The key creation date. + public ServerKey(string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string uri = default(string), System.DateTime? creationDate = default(System.DateTime?)) + : base(id, name, type) + { + Kind = kind; + Uri = uri; + CreationDate = creationDate; + CustomInit(); + } + /// + /// Static constructor for ServerKey class. + /// + static ServerKey() + { + ServerKeyType = "AzureKeyVault"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets kind of encryption protector used to protect the key. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; private set; } + + /// + /// Gets or sets the URI of the key. + /// + [JsonProperty(PropertyName = "properties.uri")] + public string Uri { get; set; } + + /// + /// Gets the key creation date. + /// + [JsonProperty(PropertyName = "properties.creationDate")] + public System.DateTime? CreationDate { get; private set; } + + /// + /// The key type like 'AzureKeyVault'. + /// + [JsonProperty(PropertyName = "properties.serverKeyType")] + public static string ServerKeyType { get; private set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPrivateEndpointConnection.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPrivateEndpointConnection.cs new file mode 100644 index 0000000000000..b711754ebf94b --- /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 0000000000000..915658ad2375f --- /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 0000000000000..fe0849058efd2 --- /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 a88781652d684..2f0292d2b4630 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,28 @@ public ServerPropertiesForCreate() /// Initializes a new instance of the ServerPropertiesForCreate class. /// /// Server version. Possible values include: - /// '9.5', '9.6', '10', '10.0', '10.2' + /// '9.5', '9.6', '10', '10.0', '10.2', '11' /// Enable ssl enforcement or not when /// connect to server. Possible values include: 'Enabled', /// 'Disabled' + /// Enforce a minimal Tls version for + /// the server. Possible values include: 'TLS1_0', 'TLS1_1', 'TLS1_2', + /// 'TLSEnforcementDisabled' + /// Status showing whether the + /// server enabled infrastructure encryption. Possible values include: + /// 'Enabled', 'Disabled' + /// Whether or not public network + /// access is allowed for this server. Value is optional but if passed + /// in, must be 'Enabled' or 'Disabled'. Possible values include: + /// 'Enabled', 'Disabled' /// Storage profile of a server. - public ServerPropertiesForCreate(string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), StorageProfile storageProfile = default(StorageProfile)) + public ServerPropertiesForCreate(string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), string minimalTlsVersion = default(string), string infrastructureEncryption = default(string), string publicNetworkAccess = default(string), StorageProfile storageProfile = default(StorageProfile)) { Version = version; SslEnforcement = sslEnforcement; + MinimalTlsVersion = minimalTlsVersion; + InfrastructureEncryption = infrastructureEncryption; + PublicNetworkAccess = publicNetworkAccess; StorageProfile = storageProfile; CustomInit(); } @@ -50,7 +63,7 @@ public ServerPropertiesForCreate() /// /// Gets or sets server version. Possible values include: '9.5', '9.6', - /// '10', '10.0', '10.2' + /// '10', '10.0', '10.2', '11' /// [JsonProperty(PropertyName = "version")] public string Version { get; set; } @@ -62,6 +75,30 @@ public ServerPropertiesForCreate() [JsonProperty(PropertyName = "sslEnforcement")] public SslEnforcementEnum? SslEnforcement { get; set; } + /// + /// Gets or sets enforce a minimal Tls version for the server. Possible + /// values include: 'TLS1_0', 'TLS1_1', 'TLS1_2', + /// 'TLSEnforcementDisabled' + /// + [JsonProperty(PropertyName = "minimalTlsVersion")] + public string MinimalTlsVersion { get; set; } + + /// + /// Gets or sets status showing whether the server enabled + /// infrastructure encryption. Possible values include: 'Enabled', + /// 'Disabled' + /// + [JsonProperty(PropertyName = "infrastructureEncryption")] + public string InfrastructureEncryption { get; set; } + + /// + /// Gets or sets whether or not public network access is allowed for + /// this server. Value is optional but if passed in, must be 'Enabled' + /// or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + /// /// Gets or sets storage profile of a server. /// diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForDefaultCreate.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForDefaultCreate.cs index e53f9da95499f..788f62930bd3e 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForDefaultCreate.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForDefaultCreate.cs @@ -39,13 +39,23 @@ public ServerPropertiesForDefaultCreate() /// The password of the /// administrator login. /// Server version. Possible values include: - /// '9.5', '9.6', '10', '10.0', '10.2' + /// '9.5', '9.6', '10', '10.0', '10.2', '11' /// Enable ssl enforcement or not when /// connect to server. Possible values include: 'Enabled', /// 'Disabled' + /// Enforce a minimal Tls version for + /// the server. Possible values include: 'TLS1_0', 'TLS1_1', 'TLS1_2', + /// 'TLSEnforcementDisabled' + /// Status showing whether the + /// server enabled infrastructure encryption. Possible values include: + /// 'Enabled', 'Disabled' + /// Whether or not public network + /// access is allowed for this server. Value is optional but if passed + /// in, must be 'Enabled' or 'Disabled'. Possible values include: + /// 'Enabled', 'Disabled' /// Storage profile of a server. - public ServerPropertiesForDefaultCreate(string administratorLogin, string administratorLoginPassword, string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), StorageProfile storageProfile = default(StorageProfile)) - : base(version, sslEnforcement, storageProfile) + public ServerPropertiesForDefaultCreate(string administratorLogin, string administratorLoginPassword, string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), string minimalTlsVersion = default(string), string infrastructureEncryption = default(string), string publicNetworkAccess = default(string), StorageProfile storageProfile = default(StorageProfile)) + : base(version, sslEnforcement, minimalTlsVersion, infrastructureEncryption, publicNetworkAccess, storageProfile) { AdministratorLogin = administratorLogin; AdministratorLoginPassword = administratorLoginPassword; diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForGeoRestore.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForGeoRestore.cs index 95e48dfb3a82c..8e52f7d9b1239 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForGeoRestore.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForGeoRestore.cs @@ -37,13 +37,23 @@ public ServerPropertiesForGeoRestore() /// The source server id to restore /// from. /// Server version. Possible values include: - /// '9.5', '9.6', '10', '10.0', '10.2' + /// '9.5', '9.6', '10', '10.0', '10.2', '11' /// Enable ssl enforcement or not when /// connect to server. Possible values include: 'Enabled', /// 'Disabled' + /// Enforce a minimal Tls version for + /// the server. Possible values include: 'TLS1_0', 'TLS1_1', 'TLS1_2', + /// 'TLSEnforcementDisabled' + /// Status showing whether the + /// server enabled infrastructure encryption. Possible values include: + /// 'Enabled', 'Disabled' + /// Whether or not public network + /// access is allowed for this server. Value is optional but if passed + /// in, must be 'Enabled' or 'Disabled'. Possible values include: + /// 'Enabled', 'Disabled' /// Storage profile of a server. - public ServerPropertiesForGeoRestore(string sourceServerId, string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), StorageProfile storageProfile = default(StorageProfile)) - : base(version, sslEnforcement, storageProfile) + public ServerPropertiesForGeoRestore(string sourceServerId, string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), string minimalTlsVersion = default(string), string infrastructureEncryption = default(string), string publicNetworkAccess = default(string), StorageProfile storageProfile = default(StorageProfile)) + : base(version, sslEnforcement, minimalTlsVersion, infrastructureEncryption, publicNetworkAccess, storageProfile) { SourceServerId = sourceServerId; CustomInit(); diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForReplica.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForReplica.cs index 994f08f9b9e6c..263423778b47b 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForReplica.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForReplica.cs @@ -34,13 +34,23 @@ public ServerPropertiesForReplica() /// The master server id to create replica /// from. /// Server version. Possible values include: - /// '9.5', '9.6', '10', '10.0', '10.2' + /// '9.5', '9.6', '10', '10.0', '10.2', '11' /// Enable ssl enforcement or not when /// connect to server. Possible values include: 'Enabled', /// 'Disabled' + /// Enforce a minimal Tls version for + /// the server. Possible values include: 'TLS1_0', 'TLS1_1', 'TLS1_2', + /// 'TLSEnforcementDisabled' + /// Status showing whether the + /// server enabled infrastructure encryption. Possible values include: + /// 'Enabled', 'Disabled' + /// Whether or not public network + /// access is allowed for this server. Value is optional but if passed + /// in, must be 'Enabled' or 'Disabled'. Possible values include: + /// 'Enabled', 'Disabled' /// Storage profile of a server. - public ServerPropertiesForReplica(string sourceServerId, string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), StorageProfile storageProfile = default(StorageProfile)) - : base(version, sslEnforcement, storageProfile) + public ServerPropertiesForReplica(string sourceServerId, string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), string minimalTlsVersion = default(string), string infrastructureEncryption = default(string), string publicNetworkAccess = default(string), StorageProfile storageProfile = default(StorageProfile)) + : base(version, sslEnforcement, minimalTlsVersion, infrastructureEncryption, publicNetworkAccess, storageProfile) { SourceServerId = sourceServerId; CustomInit(); diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForRestore.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForRestore.cs index 534c4017d197a..267d2054da1c1 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForRestore.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerPropertiesForRestore.cs @@ -36,13 +36,23 @@ public ServerPropertiesForRestore() /// Restore point creation time /// (ISO8601 format), specifying the time to restore from. /// Server version. Possible values include: - /// '9.5', '9.6', '10', '10.0', '10.2' + /// '9.5', '9.6', '10', '10.0', '10.2', '11' /// Enable ssl enforcement or not when /// connect to server. Possible values include: 'Enabled', /// 'Disabled' + /// Enforce a minimal Tls version for + /// the server. Possible values include: 'TLS1_0', 'TLS1_1', 'TLS1_2', + /// 'TLSEnforcementDisabled' + /// Status showing whether the + /// server enabled infrastructure encryption. Possible values include: + /// 'Enabled', 'Disabled' + /// Whether or not public network + /// access is allowed for this server. Value is optional but if passed + /// in, must be 'Enabled' or 'Disabled'. Possible values include: + /// 'Enabled', 'Disabled' /// Storage profile of a server. - public ServerPropertiesForRestore(string sourceServerId, System.DateTime restorePointInTime, string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), StorageProfile storageProfile = default(StorageProfile)) - : base(version, sslEnforcement, storageProfile) + public ServerPropertiesForRestore(string sourceServerId, System.DateTime restorePointInTime, string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), string minimalTlsVersion = default(string), string infrastructureEncryption = default(string), string publicNetworkAccess = default(string), StorageProfile storageProfile = default(StorageProfile)) + : base(version, sslEnforcement, minimalTlsVersion, infrastructureEncryption, publicNetworkAccess, storageProfile) { SourceServerId = sourceServerId; RestorePointInTime = restorePointInTime; diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerSecurityAlertPolicy.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerSecurityAlertPolicy.cs index c6c4368fc399e..06b616df3135d 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerSecurityAlertPolicy.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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 a3b2bf28dbb47..024c8530e8bf0 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 125c70a21b090..52022e31dfcb1 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 @@ -34,26 +34,38 @@ public ServerUpdateParameters() /// /// Initializes a new instance of the ServerUpdateParameters class. /// + /// The Azure Active Directory identity of the + /// server. /// The SKU (pricing tier) of the server. /// Storage profile of a server. /// The password of the /// administrator login. /// The version of a server. Possible values - /// include: '9.5', '9.6', '10', '10.0', '10.2' + /// include: '9.5', '9.6', '10', '10.0', '10.2', '11' /// Enable ssl enforcement or not when /// connect to server. Possible values include: 'Enabled', /// 'Disabled' + /// Enforce a minimal Tls version for + /// the server. Possible values include: 'TLS1_0', 'TLS1_1', 'TLS1_2', + /// 'TLSEnforcementDisabled' + /// Whether or not public network + /// access is allowed for this server. Value is optional but if passed + /// in, must be 'Enabled' or 'Disabled'. Possible values include: + /// 'Enabled', 'Disabled' /// The replication role of the /// server. /// Application-specific metadata in the form of /// key-value pairs. - public ServerUpdateParameters(Sku sku = default(Sku), StorageProfile storageProfile = default(StorageProfile), string administratorLoginPassword = default(string), string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), string replicationRole = default(string), IDictionary tags = default(IDictionary)) + public ServerUpdateParameters(ResourceIdentity identity = default(ResourceIdentity), Sku sku = default(Sku), StorageProfile storageProfile = default(StorageProfile), string administratorLoginPassword = default(string), string version = default(string), SslEnforcementEnum? sslEnforcement = default(SslEnforcementEnum?), string minimalTlsVersion = default(string), string publicNetworkAccess = default(string), string replicationRole = default(string), IDictionary tags = default(IDictionary)) { + Identity = identity; Sku = sku; StorageProfile = storageProfile; AdministratorLoginPassword = administratorLoginPassword; Version = version; SslEnforcement = sslEnforcement; + MinimalTlsVersion = minimalTlsVersion; + PublicNetworkAccess = publicNetworkAccess; ReplicationRole = replicationRole; Tags = tags; CustomInit(); @@ -64,6 +76,12 @@ public ServerUpdateParameters() /// partial void CustomInit(); + /// + /// Gets or sets the Azure Active Directory identity of the server. + /// + [JsonProperty(PropertyName = "identity")] + public ResourceIdentity Identity { get; set; } + /// /// Gets or sets the SKU (pricing tier) of the server. /// @@ -84,7 +102,7 @@ public ServerUpdateParameters() /// /// Gets or sets the version of a server. Possible values include: - /// '9.5', '9.6', '10', '10.0', '10.2' + /// '9.5', '9.6', '10', '10.0', '10.2', '11' /// [JsonProperty(PropertyName = "properties.version")] public string Version { get; set; } @@ -96,6 +114,22 @@ public ServerUpdateParameters() [JsonProperty(PropertyName = "properties.sslEnforcement")] public SslEnforcementEnum? SslEnforcement { get; set; } + /// + /// Gets or sets enforce a minimal Tls version for the server. Possible + /// values include: 'TLS1_0', 'TLS1_1', 'TLS1_2', + /// 'TLSEnforcementDisabled' + /// + [JsonProperty(PropertyName = "properties.minimalTlsVersion")] + public string MinimalTlsVersion { get; set; } + + /// + /// Gets or sets whether or not public network access is allowed for + /// this server. Value is optional but if passed in, must be 'Enabled' + /// or 'Disabled'. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + /// /// Gets or sets the replication role of the server. /// diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerVersion.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerVersion.cs index 7b9d6a2352fbf..195c933c4628a 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerVersion.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/ServerVersion.cs @@ -21,5 +21,6 @@ public static class ServerVersion public const string OneZero = "10"; public const string OneZeroFullStopZero = "10.0"; public const string OneZeroFullStopTwo = "10.2"; + public const string OneOne = "11"; } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Sku.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Sku.cs index 05ac437482873..a38e9ed36c75f 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Sku.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/Sku.cs @@ -40,7 +40,7 @@ public Sku() /// The size code, to be interpreted by resource as /// appropriate. /// The family of hardware. - public Sku(string name = default(string), string tier = default(string), int? capacity = default(int?), string size = default(string), string family = default(string)) + public Sku(string name, string tier = default(string), int? capacity = default(int?), string size = default(string), string family = default(string)) { Name = name; Tier = tier; @@ -97,6 +97,10 @@ public Sku() /// public virtual void Validate() { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } if (Capacity < 0) { throw new ValidationException(ValidationRules.InclusiveMinimum, "Capacity", 0); diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/StorageAutogrow.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/Models/StorageAutogrow.cs new file mode 100644 index 0000000000000..4fb501782f93d --- /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 e4b5fa78e581f..568db7f42c3ba 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 0000000000000..b1b7e3cfab0a2 --- /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 4231b126e6c89..f76bdf2825eca 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 8f132417371eb..cffba1a1967da 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 495944e1f5b5c..e27b3730208bd 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,16 +78,17 @@ internal Operations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.DBforPostgreSQL/operations").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.DBForPostgreSQL/operations").ToString(); List _queryParameters = new List(); - if (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 8354f1114cdca..0c38d863f8a79 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. /// @@ -122,15 +122,30 @@ public partial class PostgreSQLManagementClient : ServiceClient public virtual ICheckNameAvailabilityOperations CheckNameAvailability { get; private set; } + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + /// /// Gets the IServerSecurityAlertPoliciesOperations. /// public virtual IServerSecurityAlertPoliciesOperations ServerSecurityAlertPolicies { get; private set; } /// - /// Gets the IOperations. + /// Gets the IPrivateEndpointConnectionsOperations. /// - public virtual IOperations Operations { get; private set; } + public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } + + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } + + /// + /// Gets the IServerKeysOperations. + /// + public virtual IServerKeysOperations ServerKeys { get; private set; } /// /// Initializes a new instance of the PostgreSQLManagementClient class. @@ -380,12 +395,15 @@ private void Initialize() Databases = new DatabasesOperations(this); Configurations = new ConfigurationsOperations(this); LogFiles = new LogFilesOperations(this); + ServerAdministrators = new ServerAdministratorsOperations(this); LocationBasedPerformanceTier = new LocationBasedPerformanceTierOperations(this); CheckNameAvailability = new CheckNameAvailabilityOperations(this); - ServerSecurityAlertPolicies = new ServerSecurityAlertPoliciesOperations(this); Operations = new Operations(this); + ServerSecurityAlertPolicies = new ServerSecurityAlertPoliciesOperations(this); + PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); + PrivateLinkResources = new PrivateLinkResourcesOperations(this); + ServerKeys = new ServerKeysOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2017-12-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/PrivateEndpointConnectionsOperations.cs new file mode 100644 index 0000000000000..ce6bec612f892 --- /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 0000000000000..2d26956c7dc8d --- /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 0000000000000..39f329b8db20b --- /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 0000000000000..e274e4b97ab0a --- /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 15c6e3d417eaa..3dc09ffea7427 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); @@ -113,14 +132,14 @@ internal ReplicasOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/Replicas").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/Replicas").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ReplicasOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ReplicasOperationsExtensions.cs index fa54cfe93b2f0..6e80270ae7106 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ReplicasOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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 de96637c193f0..5a349f0c16705 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 @@ -19,17 +19,21 @@ public static IEnumerable> ApiInfo_PostgreSQLManag { return new Tuple[] { - new Tuple("DBforPostgreSQL", "CheckNameAvailability", "2017-12-01"), - new Tuple("DBforPostgreSQL", "Configurations", "2017-12-01"), - new Tuple("DBforPostgreSQL", "Databases", "2017-12-01"), - new Tuple("DBforPostgreSQL", "FirewallRules", "2017-12-01"), - new Tuple("DBforPostgreSQL", "LocationBasedPerformanceTier", "2017-12-01"), - new Tuple("DBforPostgreSQL", "LogFiles", "2017-12-01"), - new Tuple("DBforPostgreSQL", "Operations", "2017-12-01"), - new Tuple("DBforPostgreSQL", "Replicas", "2017-12-01"), + new Tuple("DBForPostgreSQL", "CheckNameAvailability", "2017-12-01"), + new Tuple("DBForPostgreSQL", "Configurations", "2017-12-01"), + new Tuple("DBForPostgreSQL", "Databases", "2017-12-01"), + new Tuple("DBForPostgreSQL", "FirewallRules", "2017-12-01"), + new Tuple("DBForPostgreSQL", "LocationBasedPerformanceTier", "2017-12-01"), + new Tuple("DBForPostgreSQL", "LogFiles", "2017-12-01"), + new Tuple("DBForPostgreSQL", "Operations", "2017-12-01"), + new Tuple("DBForPostgreSQL", "Replicas", "2017-12-01"), + new Tuple("DBForPostgreSQL", "ServerAdministrators", "2017-12-01"), + new Tuple("DBForPostgreSQL", "Servers", "2017-12-01"), + new Tuple("DBForPostgreSQL", "VirtualNetworkRules", "2017-12-01"), + new Tuple("DBforPostgreSQL", "PrivateEndpointConnections", "2018-06-01"), + new Tuple("DBforPostgreSQL", "PrivateLinkResources", "2018-06-01"), + new Tuple("DBforPostgreSQL", "ServerKeys", "2020-01-01"), new Tuple("DBforPostgreSQL", "ServerSecurityAlertPolicies", "2017-12-01"), - new Tuple("DBforPostgreSQL", "Servers", "2017-12-01"), - new Tuple("DBforPostgreSQL", "VirtualNetworkRules", "2017-12-01"), }.AsEnumerable(); } } 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 0000000000000..a8aa258bcde2e --- /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 0000000000000..e8d55f93089c5 --- /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/ServerKeysOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerKeysOperations.cs new file mode 100644 index 0000000000000..c47ec054c22e5 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerKeysOperations.cs @@ -0,0 +1,1184 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ServerKeysOperations operations. + /// + internal partial class ServerKeysOperations : IServiceOperations, IServerKeysOperations + { + /// + /// Initializes a new instance of the ServerKeysOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ServerKeysOperations(PostgreSQLManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the PostgreSQLManagementClient + /// + public PostgreSQLManagementClient Client { get; private set; } + + /// + /// Gets a list of Server keys. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + string apiVersion = "2020-01-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a PostgreSQL Server key. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be retrieved. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string keyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (keyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "keyName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + string apiVersion = "2020-01-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("keyName", keyName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{keyName}", System.Uri.EscapeDataString(keyName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates a PostgreSQL Server key. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be operated on (updated or + /// created). + /// + /// + /// The requested PostgreSQL Server key resource state. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string serverName, string keyName, ServerKey parameters, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(serverName, keyName, parameters, resourceGroupName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the PostgreSQL Server key with the given name. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be deleted. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string serverName, string keyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(serverName, keyName, resourceGroupName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates a PostgreSQL Server key. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be operated on (updated or + /// created). + /// + /// + /// The requested PostgreSQL Server key resource state. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string serverName, string keyName, ServerKey parameters, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (keyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "keyName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + string apiVersion = "2020-01-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("keyName", keyName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}").ToString(); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{keyName}", System.Uri.EscapeDataString(keyName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the PostgreSQL Server key with the given name. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be deleted. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string serverName, string keyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (keyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "keyName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + string apiVersion = "2020-01-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("keyName", keyName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}").ToString(); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{keyName}", System.Uri.EscapeDataString(keyName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of Server keys. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerKeysOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerKeysOperationsExtensions.cs new file mode 100644 index 0000000000000..cbcd8adb0b4ca --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerKeysOperationsExtensions.cs @@ -0,0 +1,339 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ServerKeysOperations. + /// + public static partial class ServerKeysOperationsExtensions + { + /// + /// Gets a list of Server keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + public static IPage List(this IServerKeysOperations operations, string resourceGroupName, string serverName) + { + return operations.ListAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Server keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IServerKeysOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a PostgreSQL Server key. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be retrieved. + /// + public static ServerKey Get(this IServerKeysOperations operations, string resourceGroupName, string serverName, string keyName) + { + return operations.GetAsync(resourceGroupName, serverName, keyName).GetAwaiter().GetResult(); + } + + /// + /// Gets a PostgreSQL Server key. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be retrieved. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IServerKeysOperations operations, string resourceGroupName, string serverName, string keyName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, keyName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a PostgreSQL Server key. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be operated on (updated or + /// created). + /// + /// + /// The requested PostgreSQL Server key resource state. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static ServerKey CreateOrUpdate(this IServerKeysOperations operations, string serverName, string keyName, ServerKey parameters, string resourceGroupName) + { + return operations.CreateOrUpdateAsync(serverName, keyName, parameters, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a PostgreSQL Server key. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be operated on (updated or + /// created). + /// + /// + /// The requested PostgreSQL Server key resource state. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IServerKeysOperations operations, string serverName, string keyName, ServerKey parameters, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(serverName, keyName, parameters, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the PostgreSQL Server key with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be deleted. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static void Delete(this IServerKeysOperations operations, string serverName, string keyName, string resourceGroupName) + { + operations.DeleteAsync(serverName, keyName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the PostgreSQL Server key with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be deleted. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IServerKeysOperations operations, string serverName, string keyName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(serverName, keyName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates a PostgreSQL Server key. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be operated on (updated or + /// created). + /// + /// + /// The requested PostgreSQL Server key resource state. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static ServerKey BeginCreateOrUpdate(this IServerKeysOperations operations, string serverName, string keyName, ServerKey parameters, string resourceGroupName) + { + return operations.BeginCreateOrUpdateAsync(serverName, keyName, parameters, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a PostgreSQL Server key. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be operated on (updated or + /// created). + /// + /// + /// The requested PostgreSQL Server key resource state. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IServerKeysOperations operations, string serverName, string keyName, ServerKey parameters, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(serverName, keyName, parameters, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the PostgreSQL Server key with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be deleted. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static void BeginDelete(this IServerKeysOperations operations, string serverName, string keyName, string resourceGroupName) + { + operations.BeginDeleteAsync(serverName, keyName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the PostgreSQL Server key with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the server. + /// + /// + /// The name of the PostgreSQL Server key to be deleted. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IServerKeysOperations operations, string serverName, string keyName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(serverName, keyName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a list of Server keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IServerKeysOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Server keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IServerKeysOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerSecurityAlertPoliciesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerSecurityAlertPoliciesOperations.cs index a2c21dec6ed09..37e18c157e871 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServerSecurityAlertPoliciesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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 2275799343f69..fa076ed76475f 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 c26fccb207aab..a7b8dd055e79e 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); @@ -189,14 +205,14 @@ internal ServersOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -327,8 +343,7 @@ internal ServersOperations(PostgreSQLManagementClient client) /// List all the servers in a given resource group. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// Headers that will be added to request. @@ -353,18 +368,37 @@ internal ServersOperations(PostgreSQLManagementClient client) /// public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -372,19 +406,20 @@ internal ServersOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -537,14 +572,18 @@ internal ServersOperations(PostgreSQLManagementClient client) /// public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -552,17 +591,18 @@ internal ServersOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/servers").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DBForPostgreSQL/servers").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -693,8 +733,7 @@ internal ServersOperations(PostgreSQLManagementClient client) /// Restarts a server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -716,8 +755,7 @@ internal ServersOperations(PostgreSQLManagementClient client) /// Creates a new server, or will overwrite an existing server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -748,18 +786,36 @@ internal ServersOperations(PostgreSQLManagementClient client) /// public async Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerForCreate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (serverName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); @@ -772,6 +828,7 @@ internal ServersOperations(PostgreSQLManagementClient client) { parameters.Validate(); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -779,6 +836,7 @@ internal ServersOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("parameters", parameters); @@ -787,14 +845,14 @@ internal ServersOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -950,8 +1008,7 @@ internal ServersOperations(PostgreSQLManagementClient client) /// properties present in the normal server definition. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -982,18 +1039,36 @@ internal ServersOperations(PostgreSQLManagementClient client) /// public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (serverName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); @@ -1002,6 +1077,7 @@ internal ServersOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1009,6 +1085,7 @@ internal ServersOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("parameters", parameters); @@ -1017,14 +1094,14 @@ internal ServersOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -1161,8 +1238,7 @@ internal ServersOperations(PostgreSQLManagementClient client) /// Deletes a server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -1187,22 +1263,41 @@ internal ServersOperations(PostgreSQLManagementClient client) /// public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (serverName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1210,6 +1305,7 @@ internal ServersOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -1217,14 +1313,14 @@ internal ServersOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -1337,8 +1433,7 @@ internal ServersOperations(PostgreSQLManagementClient client) /// Restarts a server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -1363,22 +1458,41 @@ internal ServersOperations(PostgreSQLManagementClient client) /// public async Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (serverName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1386,6 +1500,7 @@ internal ServersOperations(PostgreSQLManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -1393,14 +1508,14 @@ internal ServersOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/restart").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/restart").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServersOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServersOperationsExtensions.cs index 66e13411c10ad..c3e2c002f68e8 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/ServersOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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 3a7050e303869..b33e438915223 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,21 +133,22 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("virtualNetworkRuleName", virtualNetworkRuleName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{virtualNetworkRuleName}", System.Uri.EscapeDataString(virtualNetworkRuleName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -260,8 +279,7 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) /// Creates or updates an existing virtual network rule. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -289,8 +307,7 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) /// Deletes the virtual network rule with the given name. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -315,8 +332,7 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) /// Gets a list of virtual network rules in a server. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -348,6 +364,21 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (serverName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); @@ -356,10 +387,14 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ApiVersion == null) + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -369,19 +404,20 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/virtualNetworkRules").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -512,8 +548,7 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) /// Creates or updates an existing virtual network rule. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -551,6 +586,21 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (serverName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); @@ -559,9 +609,12 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ApiVersion == null) + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } } if (virtualNetworkRuleName == null) { @@ -575,6 +628,7 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) { parameters.Validate(); } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -584,6 +638,7 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("virtualNetworkRuleName", virtualNetworkRuleName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); @@ -591,15 +646,15 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{virtualNetworkRuleName}", System.Uri.EscapeDataString(virtualNetworkRuleName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -754,8 +809,7 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) /// Deletes the virtual network rule with the given name. /// /// - /// The name of the resource group that contains the resource. You can obtain - /// this value from the Azure Resource Manager API or the portal. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the server. @@ -787,6 +841,21 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (serverName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); @@ -799,10 +868,14 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ApiVersion == null) + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } } + string apiVersion = "2017-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -813,20 +886,21 @@ internal VirtualNetworkRulesOperations(PostgreSQLManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serverName", serverName); tracingParameters.Add("virtualNetworkRuleName", virtualNetworkRuleName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); _url = _url.Replace("{virtualNetworkRuleName}", System.Uri.EscapeDataString(virtualNetworkRuleName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/VirtualNetworkRulesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/VirtualNetworkRulesOperationsExtensions.cs index 85a0537b7116a..7187020c0145f 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/Generated/VirtualNetworkRulesOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/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.