From 756e843d27a814df792b3f978b70a9b44e732727 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 29 Jan 2021 04:32:43 +0000 Subject: [PATCH] CodeGen from PR 12529 in Azure/azure-rest-api-specs Merge 103065670cf27605a3c57b7ee59ef5b06ea40ad7 into e1248b874c2431a54938d30c9eba14867cc96d45 --- .../Generated/IPostgreSQLManagementClient.cs | 15 + .../IRecoverableServersOperations.cs | 52 +++ .../IServerBasedPerformanceTierOperations.cs | 52 +++ .../Generated/IServerParametersOperations.cs | 83 ++++ .../IServerSecurityAlertPoliciesOperations.cs | 47 +++ .../Generated/Models/AzureEntityResource.cs | 15 +- .../Generated/Models/Configuration.cs | 8 +- .../Models/ConfigurationListResult.cs | 53 +++ .../postgresql/Generated/Models/Database.cs | 8 +- .../Generated/Models/ErrorResponse.cs | 7 +- .../Generated/Models/FirewallRule.cs | 8 +- .../postgresql/Generated/Models/LogFile.cs | 8 +- .../Models/PerformanceTierProperties.cs | 58 ++- .../Models/PrivateEndpointConnection.cs | 8 +- .../Generated/Models/PrivateLinkResource.cs | 8 +- .../Generated/Models/ProxyResource.cs | 15 +- .../Models/RecoverableServerResource.cs | 106 +++++ .../postgresql/Generated/Models/Resource.cs | 23 +- .../src/postgresql/Generated/Models/Server.cs | 8 +- .../Models/ServerAdministratorResource.cs | 8 +- .../postgresql/Generated/Models/ServerKey.cs | 8 +- .../Models/ServerSecurityAlertPolicy.cs | 8 +- .../Generated/Models/TrackedResource.cs | 14 +- .../Generated/Models/VirtualNetworkRule.cs | 8 +- .../Generated/PostgreSQLManagementClient.cs | 18 + .../Generated/RecoverableServersOperations.cs | 270 ++++++++++++ .../RecoverableServersOperationsExtensions.cs | 65 +++ .../Generated/ReplicasOperations.cs | 2 +- .../SdkInfo_PostgreSQLManagementClient.cs | 14 +- .../ServerAdministratorsOperations.cs | 6 +- .../ServerBasedPerformanceTierOperations.cs | 270 ++++++++++++ ...asedPerformanceTierOperationsExtensions.cs | 67 +++ .../Generated/ServerParametersOperations.cs | 309 ++++++++++++++ .../ServerParametersOperationsExtensions.cs | 117 ++++++ .../ServerSecurityAlertPoliciesOperations.cs | 389 ++++++++++++++++++ ...curityAlertPoliciesOperationsExtensions.cs | 74 ++++ 36 files changed, 2143 insertions(+), 86 deletions(-) create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IRecoverableServersOperations.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerBasedPerformanceTierOperations.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerParametersOperations.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ConfigurationListResult.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/RecoverableServerResource.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/RecoverableServersOperations.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/RecoverableServersOperationsExtensions.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerBasedPerformanceTierOperations.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerBasedPerformanceTierOperationsExtensions.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerParametersOperations.cs create mode 100644 sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerParametersOperationsExtensions.cs diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IPostgreSQLManagementClient.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IPostgreSQLManagementClient.cs index 6735268b4da60..526051de4938d 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IPostgreSQLManagementClient.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IPostgreSQLManagementClient.cs @@ -97,6 +97,11 @@ public partial interface IPostgreSQLManagementClient : System.IDisposable /// IConfigurationsOperations Configurations { get; } + /// + /// Gets the IServerParametersOperations. + /// + IServerParametersOperations ServerParameters { get; } + /// /// Gets the ILogFilesOperations. /// @@ -107,6 +112,16 @@ public partial interface IPostgreSQLManagementClient : System.IDisposable /// IServerAdministratorsOperations ServerAdministrators { get; } + /// + /// Gets the IRecoverableServersOperations. + /// + IRecoverableServersOperations RecoverableServers { get; } + + /// + /// Gets the IServerBasedPerformanceTierOperations. + /// + IServerBasedPerformanceTierOperations ServerBasedPerformanceTier { get; } + /// /// Gets the ILocationBasedPerformanceTierOperations. /// diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IRecoverableServersOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IRecoverableServersOperations.cs new file mode 100644 index 0000000000000..42a0e2eac11bb --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IRecoverableServersOperations.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// RecoverableServersOperations operations. + /// + public partial interface IRecoverableServersOperations + { + /// + /// Gets a recoverable 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> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerBasedPerformanceTierOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerBasedPerformanceTierOperations.cs new file mode 100644 index 0000000000000..060629abab384 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerBasedPerformanceTierOperations.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ServerBasedPerformanceTierOperations operations. + /// + public partial interface IServerBasedPerformanceTierOperations + { + /// + /// List all the performance tiers for a 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>> ListWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerParametersOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerParametersOperations.cs new file mode 100644 index 0000000000000..a9759fe184eec --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerParametersOperations.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ServerParametersOperations operations. + /// + public partial interface IServerParametersOperations + { + /// + /// Update a list of configurations in a given server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The parameters for updating a list of server configuration. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListUpdateConfigurationsWithHttpMessagesAsync(string resourceGroupName, string serverName, ConfigurationListResult value, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a list of configurations in a given server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The parameters for updating a list of server configuration. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginListUpdateConfigurationsWithHttpMessagesAsync(string resourceGroupName, string serverName, ConfigurationListResult value, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerSecurityAlertPoliciesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerSecurityAlertPoliciesOperations.cs index cdfb5c56c6a9d..18a6440b5fdff 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerSecurityAlertPoliciesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/IServerSecurityAlertPoliciesOperations.cs @@ -77,6 +77,31 @@ public partial interface IServerSecurityAlertPoliciesOperations /// Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerSecurityAlertPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Get the server's threat detection policies. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Creates or updates a threat detection policy. /// /// @@ -104,5 +129,27 @@ public partial interface IServerSecurityAlertPoliciesOperations /// Thrown when a required parameter is null /// Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, ServerSecurityAlertPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the server's threat detection policies. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/AzureEntityResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/AzureEntityResource.cs index f2a5a62dd650d..1abb92f3a9313 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/AzureEntityResource.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/AzureEntityResource.cs @@ -14,9 +14,12 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models using System.Linq; /// - /// The resource model definition for a Azure Resource Manager resource - /// with an etag. + /// Entity Resource /// + /// + /// The resource model definition for an Azure Resource Manager resource + /// with an etag. + /// public partial class AzureEntityResource : Resource { /// @@ -30,12 +33,12 @@ public AzureEntityResource() /// /// Initializes a new instance of the AzureEntityResource class. /// - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// Resource Etag. public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) : base(id, name, type) diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Configuration.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Configuration.cs index e41b79330b4b9..c468b1d222c75 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Configuration.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Configuration.cs @@ -32,12 +32,12 @@ public Configuration() /// /// Initializes a new instance of the Configuration class. /// - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// Value of the configuration. /// Description of the configuration. /// Default value of the diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ConfigurationListResult.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ConfigurationListResult.cs new file mode 100644 index 0000000000000..015b9a704a65c --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ConfigurationListResult.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; + + /// + /// A list of server configurations. + /// + public partial class ConfigurationListResult + { + /// + /// Initializes a new instance of the ConfigurationListResult class. + /// + public ConfigurationListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConfigurationListResult class. + /// + /// The list of server configurations. + public ConfigurationListResult(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of server configurations. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Database.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Database.cs index b27e69c298d5a..29ed4ab141757 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Database.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Database.cs @@ -32,12 +32,12 @@ public Database() /// /// Initializes a new instance of the Database class. /// - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// The charset of the database. /// The collation of the database. public Database(string id = default(string), string name = default(string), string type = default(string), string charset = default(string), string collation = default(string)) diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ErrorResponse.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ErrorResponse.cs index 83a64fe687016..ce53d2e316bef 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ErrorResponse.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ErrorResponse.cs @@ -16,8 +16,13 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models using System.Linq; /// - /// The resource management error response. + /// Error Response /// + /// + /// Common error response for all Azure Resource Manager APIs to return + /// error details for failed operations. (This also follows the OData error + /// response format.) + /// public partial class ErrorResponse { /// diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/FirewallRule.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/FirewallRule.cs index 5603a81676a6c..df18ce43ac4f8 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/FirewallRule.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/FirewallRule.cs @@ -36,12 +36,12 @@ public FirewallRule() /// firewall rule. Must be IPv4 format. /// The end IP address of the server /// firewall rule. Must be IPv4 format. - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "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/postgresql/Generated/Models/LogFile.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/LogFile.cs index f2d928126710c..47114f314d240 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/LogFile.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/LogFile.cs @@ -32,12 +32,12 @@ public LogFile() /// /// Initializes a new instance of the LogFile class. /// - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// Size of the log file. /// Creation timestamp of the log /// file. diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PerformanceTierProperties.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PerformanceTierProperties.cs index 586af94324194..4922308c84edb 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PerformanceTierProperties.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PerformanceTierProperties.cs @@ -32,11 +32,29 @@ public PerformanceTierProperties() /// Initializes a new instance of the PerformanceTierProperties class. /// /// ID of the performance tier. + /// Maximum Backup retention in + /// days for the performance tier edition + /// Minimum Backup retention in + /// days for the performance tier edition + /// Max storage allowed for a + /// server. + /// Max storage allowed for a + /// server. + /// Max storage allowed for a + /// server. + /// Max storage allowed for a + /// server. /// Service level objectives /// associated with the performance tier - public PerformanceTierProperties(string id = default(string), IList serviceLevelObjectives = default(IList)) + public PerformanceTierProperties(string id = default(string), int? maxBackupRetentionDays = default(int?), int? minBackupRetentionDays = default(int?), int? maxStorageMB = default(int?), int? minLargeStorageMB = default(int?), int? maxLargeStorageMB = default(int?), int? minStorageMB = default(int?), IList serviceLevelObjectives = default(IList)) { Id = id; + MaxBackupRetentionDays = maxBackupRetentionDays; + MinBackupRetentionDays = minBackupRetentionDays; + MaxStorageMB = maxStorageMB; + MinLargeStorageMB = minLargeStorageMB; + MaxLargeStorageMB = maxLargeStorageMB; + MinStorageMB = minStorageMB; ServiceLevelObjectives = serviceLevelObjectives; CustomInit(); } @@ -52,6 +70,44 @@ public PerformanceTierProperties() [JsonProperty(PropertyName = "id")] public string Id { get; set; } + /// + /// Gets or sets maximum Backup retention in days for the performance + /// tier edition + /// + [JsonProperty(PropertyName = "maxBackupRetentionDays")] + public int? MaxBackupRetentionDays { get; set; } + + /// + /// Gets or sets minimum Backup retention in days for the performance + /// tier edition + /// + [JsonProperty(PropertyName = "minBackupRetentionDays")] + public int? MinBackupRetentionDays { get; set; } + + /// + /// Gets or sets max storage allowed for a server. + /// + [JsonProperty(PropertyName = "maxStorageMB")] + public int? MaxStorageMB { get; set; } + + /// + /// Gets or sets max storage allowed for a server. + /// + [JsonProperty(PropertyName = "minLargeStorageMB")] + public int? MinLargeStorageMB { get; set; } + + /// + /// Gets or sets max storage allowed for a server. + /// + [JsonProperty(PropertyName = "maxLargeStorageMB")] + public int? MaxLargeStorageMB { get; set; } + + /// + /// Gets or sets max storage allowed for a server. + /// + [JsonProperty(PropertyName = "minStorageMB")] + public int? MinStorageMB { get; set; } + /// /// Gets or sets service level objectives associated with the /// performance tier diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateEndpointConnection.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateEndpointConnection.cs index d0f5e74f37c6b..91734dcd678a2 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateEndpointConnection.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateEndpointConnection.cs @@ -32,12 +32,12 @@ public PrivateEndpointConnection() /// /// Initializes a new instance of the PrivateEndpointConnection class. /// - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// Private endpoint which the connection /// belongs to. /// Connection state of diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkResource.cs index d6071c15d6c7e..c50db606c02d6 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkResource.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/PrivateLinkResource.cs @@ -29,12 +29,12 @@ public PrivateLinkResource() /// /// Initializes a new instance of the PrivateLinkResource class. /// - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// The private link resource group /// id. public PrivateLinkResource(string id = default(string), string name = default(string), string type = default(string), PrivateLinkResourceProperties properties = default(PrivateLinkResourceProperties)) diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ProxyResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ProxyResource.cs index 2218086919479..11683104e8444 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ProxyResource.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ProxyResource.cs @@ -13,9 +13,12 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models using System.Linq; /// - /// The resource model definition for a ARM proxy resource. It will have - /// everything other than required location and tags + /// Proxy Resource /// + /// + /// The resource model definition for a Azure Resource Manager proxy + /// resource. It will not have tags and a location + /// public partial class ProxyResource : Resource { /// @@ -29,12 +32,12 @@ public ProxyResource() /// /// Initializes a new instance of the ProxyResource class. /// - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) : base(id, name, type) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/RecoverableServerResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/RecoverableServerResource.cs new file mode 100644 index 0000000000000..22adf3bdb7ca0 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/RecoverableServerResource.cs @@ -0,0 +1,106 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A recoverable server resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class RecoverableServerResource : ProxyResource + { + /// + /// Initializes a new instance of the RecoverableServerResource class. + /// + public RecoverableServerResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecoverableServerResource class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// The last available backup + /// date time. + /// The service level + /// objective + /// Edition of the performance tier. + /// vCore associated with the service level + /// objective + /// Hardware generation associated + /// with the service level objective + /// The PostgreSQL version + public RecoverableServerResource(string id = default(string), string name = default(string), string type = default(string), string lastAvailableBackupDateTime = default(string), string serviceLevelObjective = default(string), string edition = default(string), int? vCore = default(int?), string hardwareGeneration = default(string), string version = default(string)) + : base(id, name, type) + { + LastAvailableBackupDateTime = lastAvailableBackupDateTime; + ServiceLevelObjective = serviceLevelObjective; + Edition = edition; + VCore = vCore; + HardwareGeneration = hardwareGeneration; + Version = version; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the last available backup date time. + /// + [JsonProperty(PropertyName = "properties.lastAvailableBackupDateTime")] + public string LastAvailableBackupDateTime { get; private set; } + + /// + /// Gets the service level objective + /// + [JsonProperty(PropertyName = "properties.serviceLevelObjective")] + public string ServiceLevelObjective { get; private set; } + + /// + /// Gets edition of the performance tier. + /// + [JsonProperty(PropertyName = "properties.edition")] + public string Edition { get; private set; } + + /// + /// Gets vCore associated with the service level objective + /// + [JsonProperty(PropertyName = "properties.vCore")] + public int? VCore { get; private set; } + + /// + /// Gets hardware generation associated with the service level + /// objective + /// + [JsonProperty(PropertyName = "properties.hardwareGeneration")] + public string HardwareGeneration { get; private set; } + + /// + /// Gets the PostgreSQL version + /// + [JsonProperty(PropertyName = "properties.version")] + public string Version { get; private set; } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Resource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Resource.cs index 00ee8d855eb5e..cbfe68d847726 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Resource.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Resource.cs @@ -15,6 +15,13 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models using Newtonsoft.Json; using System.Linq; + /// + /// Resource + /// + /// + /// Common fields that are returned in the response for all Azure Resource + /// Manager resources + /// public partial class Resource : IResource { /// @@ -28,12 +35,12 @@ public Resource() /// /// Initializes a new instance of the Resource class. /// - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" public Resource(string id = default(string), string name = default(string), string type = default(string)) { Id = id; @@ -48,7 +55,7 @@ public Resource() partial void CustomInit(); /// - /// Gets fully qualified resource Id for the resource. Ex - + /// Gets fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// [JsonProperty(PropertyName = "id")] @@ -61,9 +68,9 @@ public Resource() public string Name { get; private set; } /// - /// Gets the type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// Gets the type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// [JsonProperty(PropertyName = "type")] public string Type { get; private set; } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Server.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Server.cs index 5cb4f611fe041..05cc009e2c9c2 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Server.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/Server.cs @@ -36,12 +36,12 @@ public Server() /// /// The geo-location where the resource /// lives - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// Resource tags. /// The Azure Active Directory identity of the /// server. diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerAdministratorResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerAdministratorResource.cs index c410cd4202dbc..30a0fe9f31de4 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerAdministratorResource.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerAdministratorResource.cs @@ -39,12 +39,12 @@ public ServerAdministratorResource() /// The server administrator Sid (Secure ID). /// The server Active Directory Administrator /// tenant id. - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" public 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) { diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerKey.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerKey.cs index 113635eb5fd6a..4353d11aa4fcf 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerKey.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerKey.cs @@ -32,12 +32,12 @@ public ServerKey() /// /// Initializes a new instance of the ServerKey class. /// - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// Kind of encryption protector used to protect the /// key. /// The URI of the key. diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerSecurityAlertPolicy.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerSecurityAlertPolicy.cs index 06b616df3135d..574fa927abf1f 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerSecurityAlertPolicy.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/ServerSecurityAlertPolicy.cs @@ -37,12 +37,12 @@ public ServerSecurityAlertPolicy() /// Specifies the state of the policy, whether it /// is enabled or disabled. Possible values include: 'Enabled', /// 'Disabled' - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// 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/postgresql/Generated/Models/TrackedResource.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/TrackedResource.cs index f76bdf2825eca..82b1d40a79f5c 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/TrackedResource.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/TrackedResource.cs @@ -17,8 +17,12 @@ namespace Microsoft.Azure.Management.PostgreSQL.Models using System.Linq; /// - /// The resource model definition for a ARM tracked top level resource + /// Tracked Resource /// + /// + /// The resource model definition for an Azure Resource Manager tracked top + /// level resource which has 'tags' and a 'location' + /// public partial class TrackedResource : Resource { /// @@ -34,12 +38,12 @@ public TrackedResource() /// /// The geo-location where the resource /// lives - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// Resource tags. public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) : base(id, name, type) diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkRule.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkRule.cs index cffba1a1967da..bdc2c3ab1546d 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkRule.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/Models/VirtualNetworkRule.cs @@ -34,12 +34,12 @@ public VirtualNetworkRule() /// /// The ARM resource id of the /// virtual network subnet. - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// Create firewall rule /// before the virtual network has vnet service endpoint /// enabled. diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PostgreSQLManagementClient.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PostgreSQLManagementClient.cs index 0c38d863f8a79..36237ed3a614b 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PostgreSQLManagementClient.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/PostgreSQLManagementClient.cs @@ -102,6 +102,11 @@ public partial class PostgreSQLManagementClient : ServiceClient public virtual IConfigurationsOperations Configurations { get; private set; } + /// + /// Gets the IServerParametersOperations. + /// + public virtual IServerParametersOperations ServerParameters { get; private set; } + /// /// Gets the ILogFilesOperations. /// @@ -112,6 +117,16 @@ public partial class PostgreSQLManagementClient : ServiceClient public virtual IServerAdministratorsOperations ServerAdministrators { get; private set; } + /// + /// Gets the IRecoverableServersOperations. + /// + public virtual IRecoverableServersOperations RecoverableServers { get; private set; } + + /// + /// Gets the IServerBasedPerformanceTierOperations. + /// + public virtual IServerBasedPerformanceTierOperations ServerBasedPerformanceTier { get; private set; } + /// /// Gets the ILocationBasedPerformanceTierOperations. /// @@ -394,8 +409,11 @@ private void Initialize() VirtualNetworkRules = new VirtualNetworkRulesOperations(this); Databases = new DatabasesOperations(this); Configurations = new ConfigurationsOperations(this); + ServerParameters = new ServerParametersOperations(this); LogFiles = new LogFilesOperations(this); ServerAdministrators = new ServerAdministratorsOperations(this); + RecoverableServers = new RecoverableServersOperations(this); + ServerBasedPerformanceTier = new ServerBasedPerformanceTierOperations(this); LocationBasedPerformanceTier = new LocationBasedPerformanceTierOperations(this); CheckNameAvailability = new CheckNameAvailabilityOperations(this); Operations = new Operations(this); diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/RecoverableServersOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/RecoverableServersOperations.cs new file mode 100644 index 0000000000000..3f9cf92dce968 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/RecoverableServersOperations.cs @@ -0,0 +1,270 @@ +// +// 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; + + /// + /// RecoverableServersOperations operations. + /// + internal partial class RecoverableServersOperations : IServiceOperations, IRecoverableServersOperations + { + /// + /// Initializes a new instance of the RecoverableServersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal RecoverableServersOperations(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 recoverable 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> 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}/recoverableServers").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/RecoverableServersOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/RecoverableServersOperationsExtensions.cs new file mode 100644 index 0000000000000..8ee64cd36d908 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/RecoverableServersOperationsExtensions.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for RecoverableServersOperations. + /// + public static partial class RecoverableServersOperationsExtensions + { + /// + /// Gets a recoverable 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 RecoverableServerResource Get(this IRecoverableServersOperations operations, string resourceGroupName, string serverName) + { + return operations.GetAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// Gets a recoverable 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 GetAsync(this IRecoverableServersOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ReplicasOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ReplicasOperations.cs index 3dc09ffea7427..015ea66e4a8a9 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ReplicasOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ReplicasOperations.cs @@ -132,7 +132,7 @@ 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)); diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/SdkInfo_PostgreSQLManagementClient.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/SdkInfo_PostgreSQLManagementClient.cs index 91c35835f5859..db1463224f36e 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/SdkInfo_PostgreSQLManagementClient.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/SdkInfo_PostgreSQLManagementClient.cs @@ -26,8 +26,11 @@ public static IEnumerable> ApiInfo_PostgreSQLManag new Tuple("DBForPostgreSQL", "LocationBasedPerformanceTier", "2017-12-01"), new Tuple("DBForPostgreSQL", "LogFiles", "2017-12-01"), new Tuple("DBForPostgreSQL", "Operations", "2017-12-01"), + new Tuple("DBForPostgreSQL", "RecoverableServers", "2017-12-01"), new Tuple("DBForPostgreSQL", "Replicas", "2017-12-01"), new Tuple("DBForPostgreSQL", "ServerAdministrators", "2017-12-01"), + new Tuple("DBForPostgreSQL", "ServerBasedPerformanceTier", "2017-12-01"), + new Tuple("DBForPostgreSQL", "ServerParameters", "2017-12-01"), new Tuple("DBForPostgreSQL", "Servers", "2017-12-01"), new Tuple("DBForPostgreSQL", "VirtualNetworkRules", "2017-12-01"), new Tuple("DBforPostgreSQL", "PrivateEndpointConnections", "2018-06-01"), @@ -37,16 +40,5 @@ public static IEnumerable> ApiInfo_PostgreSQLManag }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/postgresql/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp.output-folder=C:\\z\\azure-sdk-for-net\\sdk\\postgresql\\Microsoft.Azure.Management.PostgreSQL\\src\\postgresql\\Generated"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "faf8e1c19e3b36e6d16622bf168369a838b04a7f"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerAdministratorsOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerAdministratorsOperations.cs index a8aa258bcde2e..fa524e5c56256 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerAdministratorsOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerAdministratorsOperations.cs @@ -132,7 +132,7 @@ internal ServerAdministratorsOperations(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}/Administrators/activeDirectory").ToString(); + 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)); @@ -627,7 +627,7 @@ internal ServerAdministratorsOperations(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}/Administrators/activeDirectory").ToString(); + 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)); @@ -864,7 +864,7 @@ internal ServerAdministratorsOperations(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}/Administrators/activeDirectory").ToString(); + 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)); diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerBasedPerformanceTierOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerBasedPerformanceTierOperations.cs new file mode 100644 index 0000000000000..5c0ad224dc819 --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerBasedPerformanceTierOperations.cs @@ -0,0 +1,270 @@ +// +// 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; + + /// + /// ServerBasedPerformanceTierOperations operations. + /// + internal partial class ServerBasedPerformanceTierOperations : IServiceOperations, IServerBasedPerformanceTierOperations + { + /// + /// Initializes a new instance of the ServerBasedPerformanceTierOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ServerBasedPerformanceTierOperations(PostgreSQLManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the PostgreSQLManagementClient + /// + public PostgreSQLManagementClient Client { get; private set; } + + /// + /// List all the performance tiers for a 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>> 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}/performanceTiers").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerBasedPerformanceTierOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerBasedPerformanceTierOperationsExtensions.cs new file mode 100644 index 0000000000000..3f0085f06408e --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerBasedPerformanceTierOperationsExtensions.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.PostgreSQL +{ + 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 ServerBasedPerformanceTierOperations. + /// + public static partial class ServerBasedPerformanceTierOperationsExtensions + { + /// + /// List all the performance tiers for a 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 IEnumerable List(this IServerBasedPerformanceTierOperations operations, string resourceGroupName, string serverName) + { + return operations.ListAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// List all the performance tiers for a 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> ListAsync(this IServerBasedPerformanceTierOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerParametersOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerParametersOperations.cs new file mode 100644 index 0000000000000..a8d097824bf5f --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerParametersOperations.cs @@ -0,0 +1,309 @@ +// +// 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; + + /// + /// ServerParametersOperations operations. + /// + internal partial class ServerParametersOperations : IServiceOperations, IServerParametersOperations + { + /// + /// Initializes a new instance of the ServerParametersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ServerParametersOperations(PostgreSQLManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the PostgreSQLManagementClient + /// + public PostgreSQLManagementClient Client { get; private set; } + + /// + /// Update a list of configurations in a given server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The parameters for updating a list of server configuration. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> ListUpdateConfigurationsWithHttpMessagesAsync(string resourceGroupName, string serverName, ConfigurationListResult value, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginListUpdateConfigurationsWithHttpMessagesAsync(resourceGroupName, serverName, value, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a list of configurations in a given server. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The parameters for updating a list of server configuration. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginListUpdateConfigurationsWithHttpMessagesAsync(string resourceGroupName, string serverName, ConfigurationListResult value, 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 (value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "value"); + } + 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("value", value); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginListUpdateConfigurations", 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}/updateConfigurations").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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(value != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(value, 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; + } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerParametersOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerParametersOperationsExtensions.cs new file mode 100644 index 0000000000000..dea467e36bb7e --- /dev/null +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerParametersOperationsExtensions.cs @@ -0,0 +1,117 @@ +// +// 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 ServerParametersOperations. + /// + public static partial class ServerParametersOperationsExtensions + { + /// + /// Update a list of configurations in a given server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The parameters for updating a list of server configuration. + /// + public static ConfigurationListResult ListUpdateConfigurations(this IServerParametersOperations operations, string resourceGroupName, string serverName, ConfigurationListResult value) + { + return operations.ListUpdateConfigurationsAsync(resourceGroupName, serverName, value).GetAwaiter().GetResult(); + } + + /// + /// Update a list of configurations in a given server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The parameters for updating a list of server configuration. + /// + /// + /// The cancellation token. + /// + public static async Task ListUpdateConfigurationsAsync(this IServerParametersOperations operations, string resourceGroupName, string serverName, ConfigurationListResult value, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListUpdateConfigurationsWithHttpMessagesAsync(resourceGroupName, serverName, value, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a list of configurations in a given server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The parameters for updating a list of server configuration. + /// + public static ConfigurationListResult BeginListUpdateConfigurations(this IServerParametersOperations operations, string resourceGroupName, string serverName, ConfigurationListResult value) + { + return operations.BeginListUpdateConfigurationsAsync(resourceGroupName, serverName, value).GetAwaiter().GetResult(); + } + + /// + /// Update a list of configurations in a given server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// The parameters for updating a list of server configuration. + /// + /// + /// The cancellation token. + /// + public static async Task BeginListUpdateConfigurationsAsync(this IServerParametersOperations operations, string resourceGroupName, string serverName, ConfigurationListResult value, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginListUpdateConfigurationsWithHttpMessagesAsync(resourceGroupName, serverName, value, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperations.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperations.cs index 37e18c157e871..895149c46b45f 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperations.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperations.cs @@ -294,6 +294,222 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// Get the server's threat detection policies. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the server. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (serverName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serverName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + string apiVersion = "2017-12-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serverName", serverName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Creates or updates a threat detection policy. /// @@ -531,5 +747,178 @@ internal ServerSecurityAlertPoliciesOperations(PostgreSQLManagementClient client return _result; } + /// + /// Get the server's threat detection policies. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByServerNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperationsExtensions.cs b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperationsExtensions.cs index fa076ed76475f..6d65f1d60a8cc 100644 --- a/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperationsExtensions.cs +++ b/sdk/postgresql/Microsoft.Azure.Management.PostgreSQL/src/postgresql/Generated/ServerSecurityAlertPoliciesOperationsExtensions.cs @@ -107,6 +107,46 @@ public static ServerSecurityAlertPolicy CreateOrUpdate(this IServerSecurityAlert } } + /// + /// Get the server's threat detection policies. + /// + /// + /// 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 IServerSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName) + { + return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult(); + } + + /// + /// Get the server's threat detection policies. + /// + /// + /// 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 IServerSecurityAlertPoliciesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Creates or updates a threat detection policy. /// @@ -153,5 +193,39 @@ public static ServerSecurityAlertPolicy BeginCreateOrUpdate(this IServerSecurity } } + /// + /// Get the server's threat detection policies. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByServerNext(this IServerSecurityAlertPoliciesOperations operations, string nextPageLink) + { + return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get the server's threat detection policies. + /// + /// + /// 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 IServerSecurityAlertPoliciesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } }