diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoOperations.cs new file mode 100644 index 000000000000..91ebdffd4158 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoOperations.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// KustoOperations operations. + /// + public partial interface IKustoOperations + { + /// + /// Lists available operations for the Kusto sub-resources inside + /// Microsoft.Synapse provider. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists available operations for the Kusto sub-resources inside + /// Microsoft.Synapse provider. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolAttachedDatabaseConfigurationsOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolAttachedDatabaseConfigurationsOperations.cs new file mode 100644 index 000000000000..2c624ab44922 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolAttachedDatabaseConfigurationsOperations.cs @@ -0,0 +1,211 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// KustoPoolAttachedDatabaseConfigurationsOperations operations. + /// + public partial interface IKustoPoolAttachedDatabaseConfigurationsOperations + { + /// + /// Returns the list of attached database configurations of the given + /// Kusto Pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByKustoPoolWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns an attached database configuration. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates an attached database configuration. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The database parameters supplied to the CreateOrUpdate 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> CreateOrUpdateWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName, AttachedDatabaseConfiguration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the attached database configuration with the given name. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates an attached database configuration. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The database parameters supplied to the CreateOrUpdate 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> BeginCreateOrUpdateWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName, AttachedDatabaseConfiguration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the attached database configuration with the given name. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolChildResourceOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolChildResourceOperations.cs new file mode 100644 index 000000000000..3f096a6c5947 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolChildResourceOperations.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// KustoPoolChildResourceOperations operations. + /// + public partial interface IKustoPoolChildResourceOperations + { + /// + /// Checks that the Kusto Pool child resource name is valid and is not + /// already in use. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto Pool child resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CheckNameAvailabilityWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, DatabaseCheckNameRequest resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolDataConnectionsOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolDataConnectionsOperations.cs new file mode 100644 index 000000000000..e1bc2f53397c --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolDataConnectionsOperations.cs @@ -0,0 +1,410 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// KustoPoolDataConnectionsOperations operations. + /// + public partial interface IKustoPoolDataConnectionsOperations + { + /// + /// Checks that the data connection name is valid and is not already in + /// use. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CheckNameAvailabilityWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, DataConnectionCheckNameRequest dataConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Checks that the data connection parameters are valid. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The data connection parameters supplied to the CreateOrUpdate + /// 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> DataConnectionValidationMethodWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, DataConnectionValidation parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the list of data connections of the given Kusto pool + /// database. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// 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>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a data connection. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a data connection. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The data connection parameters supplied to the CreateOrUpdate + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, DataConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a data connection. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The data connection parameters supplied to the Update 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, DataConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the data connection with the given name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Checks that the data connection parameters are valid. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The data connection parameters supplied to the CreateOrUpdate + /// 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> BeginDataConnectionValidationMethodWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, DataConnectionValidation parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a data connection. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The data connection parameters supplied to the CreateOrUpdate + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, DataConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a data connection. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The data connection parameters supplied to the Update 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, DataConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the data connection with the given name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolDatabasePrincipalAssignmentsOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolDatabasePrincipalAssignmentsOperations.cs new file mode 100644 index 000000000000..cf04d8c80afa --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolDatabasePrincipalAssignmentsOperations.cs @@ -0,0 +1,265 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// KustoPoolDatabasePrincipalAssignmentsOperations operations. + /// + public partial interface IKustoPoolDatabasePrincipalAssignmentsOperations + { + /// + /// Checks that the database principal assignment is valid and is not + /// already in use. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CheckNameAvailabilityWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string databaseName, string resourceGroupName, DatabasePrincipalAssignmentCheckNameRequest principalAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all Kusto pool database principalAssignments. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string databaseName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a Kusto pool database principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a Kusto pool database principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The Kusto principalAssignments parameters supplied for the + /// 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> CreateOrUpdateWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName, DatabasePrincipalAssignment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Kusto pool principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a Kusto pool database principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The Kusto principalAssignments parameters supplied for the + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName, DatabasePrincipalAssignment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Kusto pool principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolDatabasesOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolDatabasesOperations.cs new file mode 100644 index 000000000000..de25affdc6cf --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolDatabasesOperations.cs @@ -0,0 +1,278 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// KustoPoolDatabasesOperations operations. + /// + public partial interface IKustoPoolDatabasesOperations + { + /// + /// Returns the list of databases of the given Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// 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>> ListByKustoPoolWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a database. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// 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 workspaceName, string kustoPoolName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a database. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The database parameters supplied to the CreateOrUpdate 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a database. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The database parameters supplied to the Update 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the database with the given name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a database. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The database parameters supplied to the CreateOrUpdate 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a database. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The database parameters supplied to the Update 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the database with the given name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolOperations.cs new file mode 100644 index 000000000000..7d800643f914 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolOperations.cs @@ -0,0 +1,46 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// KustoPoolOperations operations. + /// + public partial interface IKustoPoolOperations + { + /// + /// Lists eligible SKUs for Kusto Pool resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListSkusWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolPrincipalAssignmentsOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolPrincipalAssignmentsOperations.cs new file mode 100644 index 000000000000..ba128ad8a547 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolPrincipalAssignmentsOperations.cs @@ -0,0 +1,244 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// KustoPoolPrincipalAssignmentsOperations operations. + /// + public partial interface IKustoPoolPrincipalAssignmentsOperations + { + /// + /// Checks that the principal assignment name is valid and is not + /// already in use. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the principal assignment. + /// + /// + /// 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> CheckNameAvailabilityWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, ClusterPrincipalAssignmentCheckNameRequest principalAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all Kusto pool principalAssignments. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a Kusto pool principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a Kusto pool principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The Kusto pool principalAssignment's parameters supplied for the + /// 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> CreateOrUpdateWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName, ClusterPrincipalAssignment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Kusto pool principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a Kusto pool principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The Kusto pool principalAssignment's parameters supplied for the + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName, ClusterPrincipalAssignment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Kusto pool principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolsOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolsOperations.cs new file mode 100644 index 000000000000..04cd80cdc3be --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IKustoPoolsOperations.cs @@ -0,0 +1,668 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// KustoPoolsOperations operations. + /// + public partial interface IKustoPoolsOperations + { + /// + /// Checks that the kusto pool name is valid and is not already in use. + /// + /// + /// The name of Azure region. + /// + /// + /// The name of the cluster. + /// + /// + /// 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> CheckNameAvailabilityWithHttpMessagesAsync(string location, KustoPoolCheckNameRequest kustoPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List Kusto pools + /// + /// + /// List all Kusto pools + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// 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> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a Kusto pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a Kusto pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The Kusto pool parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The ETag of the Kusto Pool. Omit this value to always overwrite the + /// current Kusto Pool. Specify the last-seen ETag value to prevent + /// accidentally overwriting concurrent changes. + /// + /// + /// Set to '*' to allow a new Kusto Pool to be created, but to prevent + /// updating an existing Kusto Pool. Other values will result in a 412 + /// Pre-condition Failed response. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string workspaceName, string resourceGroupName, string kustoPoolName, KustoPool parameters, string ifMatch = default(string), string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a Kusto Kusto Pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The Kusto pool parameters supplied to the Update operation. + /// + /// + /// The ETag of the Kusto Pool. Omit this value to always overwrite the + /// current Kusto Pool. Specify the last-seen ETag value to prevent + /// accidentally overwriting concurrent changes. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string workspaceName, string resourceGroupName, string kustoPoolName, KustoPoolUpdate parameters, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Kusto pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string workspaceName, string resourceGroupName, string kustoPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stops a Kusto pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task StopWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts a Kusto pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task StartWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the SKUs available for the provided resource. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListSkusByResourceWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of language extensions that can run within KQL + /// queries. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListLanguageExtensionsWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Add a list of language extensions that can run within KQL queries. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The language extensions to add. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task AddLanguageExtensionsWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, LanguageExtensionsList languageExtensionsToAdd, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Remove a list of language extensions that can run within KQL + /// queries. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The language extensions to remove. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RemoveLanguageExtensionsWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, LanguageExtensionsList languageExtensionsToRemove, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of databases that are owned by this Kusto Pool and + /// were followed by another Kusto Pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListFollowerDatabasesWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Detaches all followers of a database owned by this Kusto Pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The follower databases properties to remove. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DetachFollowerDatabasesWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, FollowerDatabaseDefinition followerDatabaseToRemove, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a Kusto pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The Kusto pool parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The ETag of the Kusto Pool. Omit this value to always overwrite the + /// current Kusto Pool. Specify the last-seen ETag value to prevent + /// accidentally overwriting concurrent changes. + /// + /// + /// Set to '*' to allow a new Kusto Pool to be created, but to prevent + /// updating an existing Kusto Pool. Other values will result in a 412 + /// Pre-condition Failed response. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string workspaceName, string resourceGroupName, string kustoPoolName, KustoPool parameters, string ifMatch = default(string), string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a Kusto Kusto Pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The Kusto pool parameters supplied to the Update operation. + /// + /// + /// The ETag of the Kusto Pool. Omit this value to always overwrite the + /// current Kusto Pool. Specify the last-seen ETag value to prevent + /// accidentally overwriting concurrent changes. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string workspaceName, string resourceGroupName, string kustoPoolName, KustoPoolUpdate parameters, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Kusto pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string workspaceName, string resourceGroupName, string kustoPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stops a Kusto pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginStopWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Starts a Kusto pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginStartWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Add a list of language extensions that can run within KQL queries. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The language extensions to add. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginAddLanguageExtensionsWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, LanguageExtensionsList languageExtensionsToAdd, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Remove a list of language extensions that can run within KQL + /// queries. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The language extensions to remove. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRemoveLanguageExtensionsWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, LanguageExtensionsList languageExtensionsToRemove, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Detaches all followers of a database owned by this Kusto Pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The follower databases properties to remove. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDetachFollowerDatabasesWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, FollowerDatabaseDefinition followerDatabaseToRemove, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISynapseManagementClient.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISynapseManagementClient.cs index 1f82b6c5bcf4..37a9bff85962 100644 --- a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISynapseManagementClient.cs +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/ISynapseManagementClient.cs @@ -384,5 +384,50 @@ public partial interface ISynapseManagementClient : System.IDisposable /// ISparkConfigurationsOperations SparkConfigurations { get; } + /// + /// Gets the IKustoOperations. + /// + IKustoOperations KustoOperations { get; } + + /// + /// Gets the IKustoPoolOperations. + /// + IKustoPoolOperations KustoPool { get; } + + /// + /// Gets the IKustoPoolsOperations. + /// + IKustoPoolsOperations KustoPools { get; } + + /// + /// Gets the IKustoPoolChildResourceOperations. + /// + IKustoPoolChildResourceOperations KustoPoolChildResource { get; } + + /// + /// Gets the IKustoPoolAttachedDatabaseConfigurationsOperations. + /// + IKustoPoolAttachedDatabaseConfigurationsOperations KustoPoolAttachedDatabaseConfigurations { get; } + + /// + /// Gets the IKustoPoolDatabasesOperations. + /// + IKustoPoolDatabasesOperations KustoPoolDatabases { get; } + + /// + /// Gets the IKustoPoolDataConnectionsOperations. + /// + IKustoPoolDataConnectionsOperations KustoPoolDataConnections { get; } + + /// + /// Gets the IKustoPoolPrincipalAssignmentsOperations. + /// + IKustoPoolPrincipalAssignmentsOperations KustoPoolPrincipalAssignments { get; } + + /// + /// Gets the IKustoPoolDatabasePrincipalAssignmentsOperations. + /// + IKustoPoolDatabasePrincipalAssignmentsOperations KustoPoolDatabasePrincipalAssignments { get; } + } } diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IWorkspaceManagedSqlServerRecoverableSqlpoolsOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IWorkspaceManagedSqlServerRecoverableSqlPoolsOperations.cs similarity index 100% rename from sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IWorkspaceManagedSqlServerRecoverableSqlpoolsOperations.cs rename to sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/IWorkspaceManagedSqlServerRecoverableSqlPoolsOperations.cs diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoOperations.cs new file mode 100644 index 000000000000..50791c88204d --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoOperations.cs @@ -0,0 +1,384 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + 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; + + /// + /// KustoOperations operations. + /// + internal partial class KustoOperations : IServiceOperations, IKustoOperations + { + /// + /// Initializes a new instance of the KustoOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal KustoOperations(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Lists available operations for the Kusto sub-resources inside + /// Microsoft.Synapse provider. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Synapse/kustooperations").ToString(); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// Lists available operations for the Kusto sub-resources inside + /// Microsoft.Synapse provider. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoOperationsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoOperationsExtensions.cs new file mode 100644 index 000000000000..7f7e5182bdcf --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoOperationsExtensions.cs @@ -0,0 +1,91 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for KustoOperations. + /// + public static partial class KustoOperationsExtensions + { + /// + /// Lists available operations for the Kusto sub-resources inside + /// Microsoft.Synapse provider. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IKustoOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists available operations for the Kusto sub-resources inside + /// Microsoft.Synapse provider. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IKustoOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists available operations for the Kusto sub-resources inside + /// Microsoft.Synapse provider. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IKustoOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists available operations for the Kusto sub-resources inside + /// Microsoft.Synapse provider. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IKustoOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolAttachedDatabaseConfigurationsOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolAttachedDatabaseConfigurationsOperations.cs new file mode 100644 index 000000000000..2ce6e51d6f9c --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolAttachedDatabaseConfigurationsOperations.cs @@ -0,0 +1,1038 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + 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; + + /// + /// KustoPoolAttachedDatabaseConfigurationsOperations operations. + /// + internal partial class KustoPoolAttachedDatabaseConfigurationsOperations : IServiceOperations, IKustoPoolAttachedDatabaseConfigurationsOperations + { + /// + /// Initializes a new instance of the KustoPoolAttachedDatabaseConfigurationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal KustoPoolAttachedDatabaseConfigurationsOperations(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Returns the list of attached database configurations of the given Kusto + /// Pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByKustoPoolWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + 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); + } + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByKustoPool", 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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// Returns an attached database configuration. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (attachedDatabaseConfigurationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "attachedDatabaseConfigurationName"); + } + 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); + } + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("attachedDatabaseConfigurationName", attachedDatabaseConfigurationName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{attachedDatabaseConfigurationName}", System.Uri.EscapeDataString(attachedDatabaseConfigurationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates an attached database configuration. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The database parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName, AttachedDatabaseConfiguration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(workspaceName, kustoPoolName, attachedDatabaseConfigurationName, resourceGroupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the attached database configuration with the given name. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(workspaceName, kustoPoolName, attachedDatabaseConfigurationName, resourceGroupName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates an attached database configuration. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The database parameters supplied to the CreateOrUpdate 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> BeginCreateOrUpdateWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName, AttachedDatabaseConfiguration parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (attachedDatabaseConfigurationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "attachedDatabaseConfigurationName"); + } + 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 (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("attachedDatabaseConfigurationName", attachedDatabaseConfigurationName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{attachedDatabaseConfigurationName}", System.Uri.EscapeDataString(attachedDatabaseConfigurationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the attached database configuration with the given name. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (attachedDatabaseConfigurationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "attachedDatabaseConfigurationName"); + } + 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); + } + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("attachedDatabaseConfigurationName", attachedDatabaseConfigurationName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{attachedDatabaseConfigurationName}", System.Uri.EscapeDataString(attachedDatabaseConfigurationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolAttachedDatabaseConfigurationsOperationsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolAttachedDatabaseConfigurationsOperationsExtensions.cs new file mode 100644 index 000000000000..a1ad3265b450 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolAttachedDatabaseConfigurationsOperationsExtensions.cs @@ -0,0 +1,341 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + 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 KustoPoolAttachedDatabaseConfigurationsOperations. + /// + public static partial class KustoPoolAttachedDatabaseConfigurationsOperationsExtensions + { + /// + /// Returns the list of attached database configurations of the given Kusto + /// Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IEnumerable ListByKustoPool(this IKustoPoolAttachedDatabaseConfigurationsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName) + { + return operations.ListByKustoPoolAsync(workspaceName, kustoPoolName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Returns the list of attached database configurations of the given Kusto + /// Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByKustoPoolAsync(this IKustoPoolAttachedDatabaseConfigurationsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByKustoPoolWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns an attached database configuration. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static AttachedDatabaseConfiguration Get(this IKustoPoolAttachedDatabaseConfigurationsOperations operations, string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName) + { + return operations.GetAsync(workspaceName, kustoPoolName, attachedDatabaseConfigurationName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Returns an attached database configuration. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IKustoPoolAttachedDatabaseConfigurationsOperations operations, string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(workspaceName, kustoPoolName, attachedDatabaseConfigurationName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates an attached database configuration. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The database parameters supplied to the CreateOrUpdate operation. + /// + public static AttachedDatabaseConfiguration CreateOrUpdate(this IKustoPoolAttachedDatabaseConfigurationsOperations operations, string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName, AttachedDatabaseConfiguration parameters) + { + return operations.CreateOrUpdateAsync(workspaceName, kustoPoolName, attachedDatabaseConfigurationName, resourceGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an attached database configuration. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The database parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IKustoPoolAttachedDatabaseConfigurationsOperations operations, string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName, AttachedDatabaseConfiguration parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(workspaceName, kustoPoolName, attachedDatabaseConfigurationName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the attached database configuration with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static void Delete(this IKustoPoolAttachedDatabaseConfigurationsOperations operations, string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName) + { + operations.DeleteAsync(workspaceName, kustoPoolName, attachedDatabaseConfigurationName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the attached database configuration with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IKustoPoolAttachedDatabaseConfigurationsOperations operations, string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(workspaceName, kustoPoolName, attachedDatabaseConfigurationName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates an attached database configuration. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The database parameters supplied to the CreateOrUpdate operation. + /// + public static AttachedDatabaseConfiguration BeginCreateOrUpdate(this IKustoPoolAttachedDatabaseConfigurationsOperations operations, string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName, AttachedDatabaseConfiguration parameters) + { + return operations.BeginCreateOrUpdateAsync(workspaceName, kustoPoolName, attachedDatabaseConfigurationName, resourceGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an attached database configuration. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The database parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IKustoPoolAttachedDatabaseConfigurationsOperations operations, string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName, AttachedDatabaseConfiguration parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(workspaceName, kustoPoolName, attachedDatabaseConfigurationName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the attached database configuration with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static void BeginDelete(this IKustoPoolAttachedDatabaseConfigurationsOperations operations, string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName) + { + operations.BeginDeleteAsync(workspaceName, kustoPoolName, attachedDatabaseConfigurationName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the attached database configuration with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the attached database configuration. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IKustoPoolAttachedDatabaseConfigurationsOperations operations, string workspaceName, string kustoPoolName, string attachedDatabaseConfigurationName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(workspaceName, kustoPoolName, attachedDatabaseConfigurationName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolChildResourceOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolChildResourceOperations.cs new file mode 100644 index 000000000000..2fff543922d9 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolChildResourceOperations.cs @@ -0,0 +1,289 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + 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; + + /// + /// KustoPoolChildResourceOperations operations. + /// + internal partial class KustoPoolChildResourceOperations : IServiceOperations, IKustoPoolChildResourceOperations + { + /// + /// Initializes a new instance of the KustoPoolChildResourceOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal KustoPoolChildResourceOperations(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Checks that the Kusto Pool child resource name is valid and is not already + /// in use. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto Pool child resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CheckNameAvailabilityWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, DatabaseCheckNameRequest resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + resourceName.Validate(); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", 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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/checkNameAvailability").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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(resourceName != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(resourceName, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolChildResourceOperationsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolChildResourceOperationsExtensions.cs new file mode 100644 index 000000000000..389935bd117f --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolChildResourceOperationsExtensions.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for KustoPoolChildResourceOperations. + /// + public static partial class KustoPoolChildResourceOperationsExtensions + { + /// + /// Checks that the Kusto Pool child resource name is valid and is not already + /// in use. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto Pool child resource. + /// + public static CheckNameResult CheckNameAvailability(this IKustoPoolChildResourceOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, DatabaseCheckNameRequest resourceName) + { + return operations.CheckNameAvailabilityAsync(workspaceName, kustoPoolName, resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Checks that the Kusto Pool child resource name is valid and is not already + /// in use. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto Pool child resource. + /// + /// + /// The cancellation token. + /// + public static async Task CheckNameAvailabilityAsync(this IKustoPoolChildResourceOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, DatabaseCheckNameRequest resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolDataConnectionsOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolDataConnectionsOperations.cs new file mode 100644 index 000000000000..2856d07e2387 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolDataConnectionsOperations.cs @@ -0,0 +1,1870 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + 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; + + /// + /// KustoPoolDataConnectionsOperations operations. + /// + internal partial class KustoPoolDataConnectionsOperations : IServiceOperations, IKustoPoolDataConnectionsOperations + { + /// + /// Initializes a new instance of the KustoPoolDataConnectionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal KustoPoolDataConnectionsOperations(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Checks that the data connection name is valid and is not already in use. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CheckNameAvailabilityWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, DataConnectionCheckNameRequest dataConnectionName, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (dataConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataConnectionName"); + } + if (dataConnectionName != null) + { + dataConnectionName.Validate(); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("dataConnectionName", dataConnectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", 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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/checkNameAvailability").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + 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(dataConnectionName != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dataConnectionName, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// Checks that the data connection parameters are valid. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The data connection parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DataConnectionValidationMethodWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, DataConnectionValidation parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDataConnectionValidationMethodWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns the list of data connections of the given Kusto pool database. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// 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>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", 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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// Returns a data connection. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (dataConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataConnectionName"); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("dataConnectionName", dataConnectionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{dataConnectionName}", System.Uri.EscapeDataString(dataConnectionName)); + 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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 data connection. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The data connection parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, DataConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, dataConnectionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a data connection. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The data connection parameters supplied to the Update operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, DataConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, dataConnectionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the data connection with the given name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, dataConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Checks that the data connection parameters are valid. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The data connection parameters supplied to the CreateOrUpdate 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> BeginDataConnectionValidationMethodWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, DataConnectionValidation parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDataConnectionValidationMethod", 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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnectionValidation").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + 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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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 data connection. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The data connection parameters supplied to the CreateOrUpdate 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, DataConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (dataConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataConnectionName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("dataConnectionName", dataConnectionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{dataConnectionName}", System.Uri.EscapeDataString(dataConnectionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates a data connection. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The data connection parameters supplied to the Update 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, DataConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (dataConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataConnectionName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("dataConnectionName", dataConnectionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{dataConnectionName}", System.Uri.EscapeDataString(dataConnectionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the data connection with the given name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (dataConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataConnectionName"); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("dataConnectionName", dataConnectionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{dataConnectionName}", System.Uri.EscapeDataString(dataConnectionName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolDataConnectionsOperationsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolDataConnectionsOperationsExtensions.cs new file mode 100644 index 000000000000..df4ccb148482 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolDataConnectionsOperationsExtensions.cs @@ -0,0 +1,677 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + 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 KustoPoolDataConnectionsOperations. + /// + public static partial class KustoPoolDataConnectionsOperationsExtensions + { + /// + /// Checks that the data connection name is valid and is not already in use. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + public static CheckNameResult CheckNameAvailability(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, DataConnectionCheckNameRequest dataConnectionName) + { + return operations.CheckNameAvailabilityAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, dataConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Checks that the data connection name is valid and is not already in use. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The cancellation token. + /// + public static async Task CheckNameAvailabilityAsync(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, DataConnectionCheckNameRequest dataConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, dataConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Checks that the data connection parameters are valid. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The data connection parameters supplied to the CreateOrUpdate operation. + /// + public static DataConnectionValidationListResult DataConnectionValidationMethod(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, DataConnectionValidation parameters) + { + return operations.DataConnectionValidationMethodAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Checks that the data connection parameters are valid. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The data connection parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The cancellation token. + /// + public static async Task DataConnectionValidationMethodAsync(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, DataConnectionValidation parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DataConnectionValidationMethodWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the list of data connections of the given Kusto pool database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + public static IEnumerable ListByDatabase(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName) + { + return operations.ListByDatabaseAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Returns the list of data connections of the given Kusto pool database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDatabaseAsync(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDatabaseWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns a data connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + public static DataConnection Get(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName) + { + return operations.GetAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, dataConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Returns a data connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, dataConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a data connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The data connection parameters supplied to the CreateOrUpdate operation. + /// + public static DataConnection CreateOrUpdate(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, DataConnection parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, dataConnectionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a data connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The data connection parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, DataConnection parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, dataConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a data connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The data connection parameters supplied to the Update operation. + /// + public static DataConnection Update(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, DataConnection parameters) + { + return operations.UpdateAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, dataConnectionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a data connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The data connection parameters supplied to the Update operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, DataConnection parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, dataConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the data connection with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + public static void Delete(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName) + { + operations.DeleteAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, dataConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the data connection with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, dataConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Checks that the data connection parameters are valid. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The data connection parameters supplied to the CreateOrUpdate operation. + /// + public static DataConnectionValidationListResult BeginDataConnectionValidationMethod(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, DataConnectionValidation parameters) + { + return operations.BeginDataConnectionValidationMethodAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Checks that the data connection parameters are valid. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The data connection parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDataConnectionValidationMethodAsync(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, DataConnectionValidation parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDataConnectionValidationMethodWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a data connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The data connection parameters supplied to the CreateOrUpdate operation. + /// + public static DataConnection BeginCreateOrUpdate(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, DataConnection parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, dataConnectionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a data connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The data connection parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, DataConnection parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, dataConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a data connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The data connection parameters supplied to the Update operation. + /// + public static DataConnection BeginUpdate(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, DataConnection parameters) + { + return operations.BeginUpdateAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, dataConnectionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a data connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The data connection parameters supplied to the Update operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, DataConnection parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, dataConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the data connection with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + public static void BeginDelete(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName) + { + operations.BeginDeleteAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, dataConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the data connection with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the data connection. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IKustoPoolDataConnectionsOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, string dataConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, dataConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolDatabasePrincipalAssignmentsOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolDatabasePrincipalAssignmentsOperations.cs new file mode 100644 index 000000000000..6b039cb5c846 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolDatabasePrincipalAssignmentsOperations.cs @@ -0,0 +1,1305 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + 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; + + /// + /// KustoPoolDatabasePrincipalAssignmentsOperations operations. + /// + internal partial class KustoPoolDatabasePrincipalAssignmentsOperations : IServiceOperations, IKustoPoolDatabasePrincipalAssignmentsOperations + { + /// + /// Initializes a new instance of the KustoPoolDatabasePrincipalAssignmentsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal KustoPoolDatabasePrincipalAssignmentsOperations(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Checks that the database principal assignment is valid and is not already + /// in use. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CheckNameAvailabilityWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string databaseName, string resourceGroupName, DatabasePrincipalAssignmentCheckNameRequest principalAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + 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 (principalAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "principalAssignmentName"); + } + if (principalAssignmentName != null) + { + principalAssignmentName.Validate(); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("principalAssignmentName", principalAssignmentName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", 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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/checkPrincipalAssignmentNameAvailability").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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(principalAssignmentName != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(principalAssignmentName, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// Lists all Kusto pool database principalAssignments. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string databaseName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + 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); + } + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a Kusto pool database principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (principalAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "principalAssignmentName"); + } + 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); + } + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("principalAssignmentName", principalAssignmentName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{principalAssignmentName}", System.Uri.EscapeDataString(principalAssignmentName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates a Kusto pool database principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The Kusto principalAssignments parameters supplied for the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName, DatabasePrincipalAssignment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(workspaceName, kustoPoolName, databaseName, principalAssignmentName, resourceGroupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a Kusto pool principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(workspaceName, kustoPoolName, databaseName, principalAssignmentName, resourceGroupName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a Kusto pool database principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The Kusto principalAssignments parameters supplied for the 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> BeginCreateOrUpdateWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName, DatabasePrincipalAssignment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (principalAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "principalAssignmentName"); + } + 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 (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("principalAssignmentName", principalAssignmentName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{principalAssignmentName}", System.Uri.EscapeDataString(principalAssignmentName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a Kusto pool principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (principalAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "principalAssignmentName"); + } + 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); + } + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("principalAssignmentName", principalAssignmentName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + _url = _url.Replace("{principalAssignmentName}", System.Uri.EscapeDataString(principalAssignmentName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolDatabasePrincipalAssignmentsOperationsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolDatabasePrincipalAssignmentsOperationsExtensions.cs new file mode 100644 index 000000000000..d3faacc380e8 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolDatabasePrincipalAssignmentsOperationsExtensions.cs @@ -0,0 +1,435 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + 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 KustoPoolDatabasePrincipalAssignmentsOperations. + /// + public static partial class KustoPoolDatabasePrincipalAssignmentsOperationsExtensions + { + /// + /// Checks that the database principal assignment is valid and is not already + /// in use. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the resource. + /// + public static CheckNameResult CheckNameAvailability(this IKustoPoolDatabasePrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string databaseName, string resourceGroupName, DatabasePrincipalAssignmentCheckNameRequest principalAssignmentName) + { + return operations.CheckNameAvailabilityAsync(workspaceName, kustoPoolName, databaseName, resourceGroupName, principalAssignmentName).GetAwaiter().GetResult(); + } + + /// + /// Checks that the database principal assignment is valid and is not already + /// in use. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the resource. + /// + /// + /// The cancellation token. + /// + public static async Task CheckNameAvailabilityAsync(this IKustoPoolDatabasePrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string databaseName, string resourceGroupName, DatabasePrincipalAssignmentCheckNameRequest principalAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(workspaceName, kustoPoolName, databaseName, resourceGroupName, principalAssignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all Kusto pool database principalAssignments. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IEnumerable List(this IKustoPoolDatabasePrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string databaseName, string resourceGroupName) + { + return operations.ListAsync(workspaceName, kustoPoolName, databaseName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all Kusto pool database principalAssignments. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IKustoPoolDatabasePrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string databaseName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(workspaceName, kustoPoolName, databaseName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a Kusto pool database principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static DatabasePrincipalAssignment Get(this IKustoPoolDatabasePrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName) + { + return operations.GetAsync(workspaceName, kustoPoolName, databaseName, principalAssignmentName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a Kusto pool database principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IKustoPoolDatabasePrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(workspaceName, kustoPoolName, databaseName, principalAssignmentName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a Kusto pool database principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The Kusto principalAssignments parameters supplied for the operation. + /// + public static DatabasePrincipalAssignment CreateOrUpdate(this IKustoPoolDatabasePrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName, DatabasePrincipalAssignment parameters) + { + return operations.CreateOrUpdateAsync(workspaceName, kustoPoolName, databaseName, principalAssignmentName, resourceGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a Kusto pool database principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The Kusto principalAssignments parameters supplied for the operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IKustoPoolDatabasePrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName, DatabasePrincipalAssignment parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(workspaceName, kustoPoolName, databaseName, principalAssignmentName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Kusto pool principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static void Delete(this IKustoPoolDatabasePrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName) + { + operations.DeleteAsync(workspaceName, kustoPoolName, databaseName, principalAssignmentName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Kusto pool principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IKustoPoolDatabasePrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(workspaceName, kustoPoolName, databaseName, principalAssignmentName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates a Kusto pool database principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The Kusto principalAssignments parameters supplied for the operation. + /// + public static DatabasePrincipalAssignment BeginCreateOrUpdate(this IKustoPoolDatabasePrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName, DatabasePrincipalAssignment parameters) + { + return operations.BeginCreateOrUpdateAsync(workspaceName, kustoPoolName, databaseName, principalAssignmentName, resourceGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a Kusto pool database principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The Kusto principalAssignments parameters supplied for the operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IKustoPoolDatabasePrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName, DatabasePrincipalAssignment parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(workspaceName, kustoPoolName, databaseName, principalAssignmentName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Kusto pool principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static void BeginDelete(this IKustoPoolDatabasePrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName) + { + operations.BeginDeleteAsync(workspaceName, kustoPoolName, databaseName, principalAssignmentName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Kusto pool principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IKustoPoolDatabasePrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string databaseName, string principalAssignmentName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(workspaceName, kustoPoolName, databaseName, principalAssignmentName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolDatabasesOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolDatabasesOperations.cs new file mode 100644 index 000000000000..20f68f7113c9 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolDatabasesOperations.cs @@ -0,0 +1,1303 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + 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; + + /// + /// KustoPoolDatabasesOperations operations. + /// + internal partial class KustoPoolDatabasesOperations : IServiceOperations, IKustoPoolDatabasesOperations + { + /// + /// Initializes a new instance of the KustoPoolDatabasesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal KustoPoolDatabasesOperations(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Returns the list of databases of the given Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// 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>> ListByKustoPoolWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByKustoPool", 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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// Returns a database. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// 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 workspaceName, string kustoPoolName, string databaseName, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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 database. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The database parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a database. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The database parameters supplied to the Update operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the database with the given name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates a database. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The database parameters supplied to the CreateOrUpdate 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates a database. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The database parameters supplied to the Update 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the database with the given name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, 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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (databaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "databaseName"); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("databaseName", databaseName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolDatabasesOperationsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolDatabasesOperationsExtensions.cs new file mode 100644 index 000000000000..65af87257d6f --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolDatabasesOperationsExtensions.cs @@ -0,0 +1,455 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + 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 KustoPoolDatabasesOperations. + /// + public static partial class KustoPoolDatabasesOperationsExtensions + { + /// + /// Returns the list of databases of the given Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + public static IEnumerable ListByKustoPool(this IKustoPoolDatabasesOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName) + { + return operations.ListByKustoPoolAsync(resourceGroupName, workspaceName, kustoPoolName).GetAwaiter().GetResult(); + } + + /// + /// Returns the list of databases of the given Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByKustoPoolAsync(this IKustoPoolDatabasesOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByKustoPoolWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns a database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + public static Database Get(this IKustoPoolDatabasesOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName) + { + return operations.GetAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Returns a database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IKustoPoolDatabasesOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The database parameters supplied to the CreateOrUpdate operation. + /// + public static Database CreateOrUpdate(this IKustoPoolDatabasesOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Database parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The database parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IKustoPoolDatabasesOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Database parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The database parameters supplied to the Update operation. + /// + public static Database Update(this IKustoPoolDatabasesOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Database parameters) + { + return operations.UpdateAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The database parameters supplied to the Update operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IKustoPoolDatabasesOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Database parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the database with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + public static void Delete(this IKustoPoolDatabasesOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName) + { + operations.DeleteAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the database with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IKustoPoolDatabasesOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates a database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The database parameters supplied to the CreateOrUpdate operation. + /// + public static Database BeginCreateOrUpdate(this IKustoPoolDatabasesOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Database parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The database parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IKustoPoolDatabasesOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Database parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The database parameters supplied to the Update operation. + /// + public static Database BeginUpdate(this IKustoPoolDatabasesOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Database parameters) + { + return operations.BeginUpdateAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a database. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The database parameters supplied to the Update operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IKustoPoolDatabasesOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, Database parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the database with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + public static void BeginDelete(this IKustoPoolDatabasesOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName) + { + operations.BeginDeleteAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the database with the given name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the database in the Kusto pool. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IKustoPoolDatabasesOperations operations, string resourceGroupName, string workspaceName, string kustoPoolName, string databaseName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, kustoPoolName, databaseName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolOperations.cs new file mode 100644 index 000000000000..1d3bae15faf5 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolOperations.cs @@ -0,0 +1,232 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + 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; + + /// + /// KustoPoolOperations operations. + /// + internal partial class KustoPoolOperations : IServiceOperations, IKustoPoolOperations + { + /// + /// Initializes a new instance of the KustoPoolOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal KustoPoolOperations(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Lists eligible SKUs for Kusto Pool resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListSkusWithHttpMessagesAsync(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); + } + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListSkus", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Synapse/skus").ToString(); + _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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolOperationsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolOperationsExtensions.cs new file mode 100644 index 000000000000..9433669eb944 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolOperationsExtensions.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + 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 KustoPoolOperations. + /// + public static partial class KustoPoolOperationsExtensions + { + /// + /// Lists eligible SKUs for Kusto Pool resource. + /// + /// + /// The operations group for this extension method. + /// + public static IEnumerable ListSkus(this IKustoPoolOperations operations) + { + return operations.ListSkusAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists eligible SKUs for Kusto Pool resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListSkusAsync(this IKustoPoolOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListSkusWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolPrincipalAssignmentsOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolPrincipalAssignmentsOperations.cs new file mode 100644 index 000000000000..3eb13c7230d9 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolPrincipalAssignmentsOperations.cs @@ -0,0 +1,1254 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + 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; + + /// + /// KustoPoolPrincipalAssignmentsOperations operations. + /// + internal partial class KustoPoolPrincipalAssignmentsOperations : IServiceOperations, IKustoPoolPrincipalAssignmentsOperations + { + /// + /// Initializes a new instance of the KustoPoolPrincipalAssignmentsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal KustoPoolPrincipalAssignmentsOperations(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Checks that the principal assignment name is valid and is not already in + /// use. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the principal assignment. + /// + /// + /// 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> CheckNameAvailabilityWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, ClusterPrincipalAssignmentCheckNameRequest principalAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + 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 (principalAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "principalAssignmentName"); + } + if (principalAssignmentName != null) + { + principalAssignmentName.Validate(); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("principalAssignmentName", principalAssignmentName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", 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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/checkPrincipalAssignmentNameAvailability").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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(principalAssignmentName != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(principalAssignmentName, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// Lists all Kusto pool principalAssignments. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + 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); + } + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a Kusto pool principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (principalAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "principalAssignmentName"); + } + 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); + } + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("principalAssignmentName", principalAssignmentName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{principalAssignmentName}", System.Uri.EscapeDataString(principalAssignmentName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// Create a Kusto pool principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The Kusto pool principalAssignment's parameters supplied for the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName, ClusterPrincipalAssignment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(workspaceName, kustoPoolName, principalAssignmentName, resourceGroupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a Kusto pool principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(workspaceName, kustoPoolName, principalAssignmentName, resourceGroupName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create a Kusto pool principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The Kusto pool principalAssignment's parameters supplied for the 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> BeginCreateOrUpdateWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName, ClusterPrincipalAssignment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (principalAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "principalAssignmentName"); + } + 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 (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("principalAssignmentName", principalAssignmentName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{principalAssignmentName}", System.Uri.EscapeDataString(principalAssignmentName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a Kusto pool principalAssignment. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (principalAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "principalAssignmentName"); + } + 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); + } + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("principalAssignmentName", principalAssignmentName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{principalAssignmentName}", System.Uri.EscapeDataString(principalAssignmentName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolPrincipalAssignmentsOperationsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolPrincipalAssignmentsOperationsExtensions.cs new file mode 100644 index 000000000000..0a6e802a2ac7 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolPrincipalAssignmentsOperationsExtensions.cs @@ -0,0 +1,393 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + 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 KustoPoolPrincipalAssignmentsOperations. + /// + public static partial class KustoPoolPrincipalAssignmentsOperationsExtensions + { + /// + /// Checks that the principal assignment name is valid and is not already in + /// use. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the principal assignment. + /// + public static CheckNameResult CheckNameAvailability(this IKustoPoolPrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, ClusterPrincipalAssignmentCheckNameRequest principalAssignmentName) + { + return operations.CheckNameAvailabilityAsync(workspaceName, kustoPoolName, resourceGroupName, principalAssignmentName).GetAwaiter().GetResult(); + } + + /// + /// Checks that the principal assignment name is valid and is not already in + /// use. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the principal assignment. + /// + /// + /// The cancellation token. + /// + public static async Task CheckNameAvailabilityAsync(this IKustoPoolPrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, ClusterPrincipalAssignmentCheckNameRequest principalAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, principalAssignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all Kusto pool principalAssignments. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IEnumerable List(this IKustoPoolPrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName) + { + return operations.ListAsync(workspaceName, kustoPoolName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all Kusto pool principalAssignments. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IKustoPoolPrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a Kusto pool principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static ClusterPrincipalAssignment Get(this IKustoPoolPrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName) + { + return operations.GetAsync(workspaceName, kustoPoolName, principalAssignmentName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a Kusto pool principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IKustoPoolPrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(workspaceName, kustoPoolName, principalAssignmentName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create a Kusto pool principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The Kusto pool principalAssignment's parameters supplied for the operation. + /// + public static ClusterPrincipalAssignment CreateOrUpdate(this IKustoPoolPrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName, ClusterPrincipalAssignment parameters) + { + return operations.CreateOrUpdateAsync(workspaceName, kustoPoolName, principalAssignmentName, resourceGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create a Kusto pool principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The Kusto pool principalAssignment's parameters supplied for the operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IKustoPoolPrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName, ClusterPrincipalAssignment parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(workspaceName, kustoPoolName, principalAssignmentName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Kusto pool principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static void Delete(this IKustoPoolPrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName) + { + operations.DeleteAsync(workspaceName, kustoPoolName, principalAssignmentName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Kusto pool principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IKustoPoolPrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(workspaceName, kustoPoolName, principalAssignmentName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create a Kusto pool principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The Kusto pool principalAssignment's parameters supplied for the operation. + /// + public static ClusterPrincipalAssignment BeginCreateOrUpdate(this IKustoPoolPrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName, ClusterPrincipalAssignment parameters) + { + return operations.BeginCreateOrUpdateAsync(workspaceName, kustoPoolName, principalAssignmentName, resourceGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create a Kusto pool principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The Kusto pool principalAssignment's parameters supplied for the operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IKustoPoolPrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName, ClusterPrincipalAssignment parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(workspaceName, kustoPoolName, principalAssignmentName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Kusto pool principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static void BeginDelete(this IKustoPoolPrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName) + { + operations.BeginDeleteAsync(workspaceName, kustoPoolName, principalAssignmentName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Kusto pool principalAssignment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the Kusto principalAssignment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IKustoPoolPrincipalAssignmentsOperations operations, string workspaceName, string kustoPoolName, string principalAssignmentName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(workspaceName, kustoPoolName, principalAssignmentName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolsOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolsOperations.cs new file mode 100644 index 000000000000..870bcbe16d9d --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolsOperations.cs @@ -0,0 +1,3329 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + 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; + + /// + /// KustoPoolsOperations operations. + /// + internal partial class KustoPoolsOperations : IServiceOperations, IKustoPoolsOperations + { + /// + /// Initializes a new instance of the KustoPoolsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal KustoPoolsOperations(SynapseManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SynapseManagementClient + /// + public SynapseManagementClient Client { get; private set; } + + /// + /// Checks that the kusto pool name is valid and is not already in use. + /// + /// + /// The name of Azure region. + /// + /// + /// The name of the cluster. + /// + /// + /// 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> CheckNameAvailabilityWithHttpMessagesAsync(string location, KustoPoolCheckNameRequest kustoPoolName, 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 (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (location.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "location", 1); + } + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (kustoPoolName != null) + { + kustoPoolName.Validate(); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Synapse/locations/{location}/kustoPoolCheckNameAvailability").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + 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(kustoPoolName != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(kustoPoolName, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List Kusto pools + /// + /// + /// List all Kusto pools + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// 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> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, 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 (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 (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + string apiVersion = "2021-06-01-preview"; + // 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("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspace", 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.Synapse/workspaces/{workspaceName}/kustoPools").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a Kusto pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + 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); + } + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// Create or update a Kusto pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The Kusto pool parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The ETag of the Kusto Pool. Omit this value to always overwrite the current + /// Kusto Pool. Specify the last-seen ETag value to prevent accidentally + /// overwriting concurrent changes. + /// + /// + /// Set to '*' to allow a new Kusto Pool to be created, but to prevent updating + /// an existing Kusto Pool. Other values will result in a 412 Pre-condition + /// Failed response. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string workspaceName, string resourceGroupName, string kustoPoolName, KustoPool parameters, string ifMatch = default(string), string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(workspaceName, resourceGroupName, kustoPoolName, parameters, ifMatch, ifNoneMatch, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a Kusto Kusto Pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The Kusto pool parameters supplied to the Update operation. + /// + /// + /// The ETag of the Kusto Pool. Omit this value to always overwrite the current + /// Kusto Pool. Specify the last-seen ETag value to prevent accidentally + /// overwriting concurrent changes. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string workspaceName, string resourceGroupName, string kustoPoolName, KustoPoolUpdate parameters, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(workspaceName, resourceGroupName, kustoPoolName, parameters, ifMatch, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a Kusto pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string workspaceName, string resourceGroupName, string kustoPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(workspaceName, resourceGroupName, kustoPoolName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Stops a Kusto pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StopWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Starts a Kusto pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns the SKUs available for the provided resource. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListSkusByResourceWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + 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); + } + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListSkusByResource", 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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/skus").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// Returns a list of language extensions that can run within KQL queries. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListLanguageExtensionsWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + 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); + } + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListLanguageExtensions", 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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/listLanguageExtensions").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// Add a list of language extensions that can run within KQL queries. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The language extensions to add. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task AddLanguageExtensionsWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, LanguageExtensionsList languageExtensionsToAdd, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginAddLanguageExtensionsWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, languageExtensionsToAdd, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Remove a list of language extensions that can run within KQL queries. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The language extensions to remove. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RemoveLanguageExtensionsWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, LanguageExtensionsList languageExtensionsToRemove, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRemoveLanguageExtensionsWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, languageExtensionsToRemove, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns a list of databases that are owned by this Kusto Pool and were + /// followed by another Kusto Pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListFollowerDatabasesWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + 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); + } + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListFollowerDatabases", 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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/listFollowerDatabases").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// Detaches all followers of a database owned by this Kusto Pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The follower databases properties to remove. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DetachFollowerDatabasesWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, FollowerDatabaseDefinition followerDatabaseToRemove, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDetachFollowerDatabasesWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, followerDatabaseToRemove, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or update a Kusto pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The Kusto pool parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The ETag of the Kusto Pool. Omit this value to always overwrite the current + /// Kusto Pool. Specify the last-seen ETag value to prevent accidentally + /// overwriting concurrent changes. + /// + /// + /// Set to '*' to allow a new Kusto Pool to be created, but to prevent updating + /// an existing Kusto Pool. Other values will result in a 412 Pre-condition + /// Failed response. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string workspaceName, string resourceGroupName, string kustoPoolName, KustoPool parameters, string ifMatch = default(string), string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + 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 (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("ifNoneMatch", ifNoneMatch); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + if (ifNoneMatch != null) + { + if (_httpRequest.Headers.Contains("If-None-Match")) + { + _httpRequest.Headers.Remove("If-None-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-None-Match", ifNoneMatch); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update a Kusto Kusto Pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The Kusto pool parameters supplied to the Update operation. + /// + /// + /// The ETag of the Kusto Pool. Omit this value to always overwrite the current + /// Kusto Pool. Specify the last-seen ETag value to prevent accidentally + /// overwriting concurrent changes. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string workspaceName, string resourceGroupName, string kustoPoolName, KustoPoolUpdate parameters, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + 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 (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _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("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a Kusto pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string workspaceName, string resourceGroupName, string kustoPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + 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 (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + 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 = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Stops a Kusto pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginStopWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + 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); + } + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStop", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/stop").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Starts a Kusto pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginStartWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + 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); + } + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginStart", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/start").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Add a list of language extensions that can run within KQL queries. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The language extensions to add. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginAddLanguageExtensionsWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, LanguageExtensionsList languageExtensionsToAdd, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + 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 (languageExtensionsToAdd == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "languageExtensionsToAdd"); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("languageExtensionsToAdd", languageExtensionsToAdd); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginAddLanguageExtensions", 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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/addLanguageExtensions").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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(languageExtensionsToAdd != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(languageExtensionsToAdd, 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Remove a list of language extensions that can run within KQL queries. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The language extensions to remove. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRemoveLanguageExtensionsWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, LanguageExtensionsList languageExtensionsToRemove, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + 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 (languageExtensionsToRemove == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "languageExtensionsToRemove"); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("languageExtensionsToRemove", languageExtensionsToRemove); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRemoveLanguageExtensions", 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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/removeLanguageExtensions").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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(languageExtensionsToRemove != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(languageExtensionsToRemove, 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Detaches all followers of a database owned by this Kusto Pool. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The follower databases properties to remove. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDetachFollowerDatabasesWithHttpMessagesAsync(string workspaceName, string kustoPoolName, string resourceGroupName, FollowerDatabaseDefinition followerDatabaseToRemove, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (kustoPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kustoPoolName"); + } + 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 (followerDatabaseToRemove == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "followerDatabaseToRemove"); + } + if (followerDatabaseToRemove != null) + { + followerDatabaseToRemove.Validate(); + } + string apiVersion = "2021-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("kustoPoolName", kustoPoolName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("followerDatabaseToRemove", followerDatabaseToRemove); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDetachFollowerDatabases", 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.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/detachFollowerDatabases").ToString(); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{kustoPoolName}", System.Uri.EscapeDataString(kustoPoolName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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(followerDatabaseToRemove != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(followerDatabaseToRemove, 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolsOperationsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolsOperationsExtensions.cs new file mode 100644 index 000000000000..3d8da26a6dbd --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/KustoPoolsOperationsExtensions.cs @@ -0,0 +1,1119 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse +{ + 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 KustoPoolsOperations. + /// + public static partial class KustoPoolsOperationsExtensions + { + /// + /// Checks that the kusto pool name is valid and is not already in use. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of Azure region. + /// + /// + /// The name of the cluster. + /// + public static CheckNameResult CheckNameAvailability(this IKustoPoolsOperations operations, string location, KustoPoolCheckNameRequest kustoPoolName) + { + return operations.CheckNameAvailabilityAsync(location, kustoPoolName).GetAwaiter().GetResult(); + } + + /// + /// Checks that the kusto pool name is valid and is not already in use. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of Azure region. + /// + /// + /// The name of the cluster. + /// + /// + /// The cancellation token. + /// + public static async Task CheckNameAvailabilityAsync(this IKustoPoolsOperations operations, string location, KustoPoolCheckNameRequest kustoPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(location, kustoPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List Kusto pools + /// + /// + /// List all Kusto pools + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + public static KustoPoolListResult ListByWorkspace(this IKustoPoolsOperations operations, string resourceGroupName, string workspaceName) + { + return operations.ListByWorkspaceAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// List Kusto pools + /// + /// + /// List all Kusto pools + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace + /// + /// + /// The cancellation token. + /// + public static async Task ListByWorkspaceAsync(this IKustoPoolsOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByWorkspaceWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static KustoPool Get(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName) + { + return operations.GetAsync(workspaceName, kustoPoolName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The Kusto pool parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The ETag of the Kusto Pool. Omit this value to always overwrite the current + /// Kusto Pool. Specify the last-seen ETag value to prevent accidentally + /// overwriting concurrent changes. + /// + /// + /// Set to '*' to allow a new Kusto Pool to be created, but to prevent updating + /// an existing Kusto Pool. Other values will result in a 412 Pre-condition + /// Failed response. + /// + public static KustoPool CreateOrUpdate(this IKustoPoolsOperations operations, string workspaceName, string resourceGroupName, string kustoPoolName, KustoPool parameters, string ifMatch = default(string), string ifNoneMatch = default(string)) + { + return operations.CreateOrUpdateAsync(workspaceName, resourceGroupName, kustoPoolName, parameters, ifMatch, ifNoneMatch).GetAwaiter().GetResult(); + } + + /// + /// Create or update a Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The Kusto pool parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The ETag of the Kusto Pool. Omit this value to always overwrite the current + /// Kusto Pool. Specify the last-seen ETag value to prevent accidentally + /// overwriting concurrent changes. + /// + /// + /// Set to '*' to allow a new Kusto Pool to be created, but to prevent updating + /// an existing Kusto Pool. Other values will result in a 412 Pre-condition + /// Failed response. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IKustoPoolsOperations operations, string workspaceName, string resourceGroupName, string kustoPoolName, KustoPool parameters, string ifMatch = default(string), string ifNoneMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(workspaceName, resourceGroupName, kustoPoolName, parameters, ifMatch, ifNoneMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a Kusto Kusto Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The Kusto pool parameters supplied to the Update operation. + /// + /// + /// The ETag of the Kusto Pool. Omit this value to always overwrite the current + /// Kusto Pool. Specify the last-seen ETag value to prevent accidentally + /// overwriting concurrent changes. + /// + public static KustoPool Update(this IKustoPoolsOperations operations, string workspaceName, string resourceGroupName, string kustoPoolName, KustoPoolUpdate parameters, string ifMatch = default(string)) + { + return operations.UpdateAsync(workspaceName, resourceGroupName, kustoPoolName, parameters, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Update a Kusto Kusto Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The Kusto pool parameters supplied to the Update operation. + /// + /// + /// The ETag of the Kusto Pool. Omit this value to always overwrite the current + /// Kusto Pool. Specify the last-seen ETag value to prevent accidentally + /// overwriting concurrent changes. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IKustoPoolsOperations operations, string workspaceName, string resourceGroupName, string kustoPoolName, KustoPoolUpdate parameters, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(workspaceName, resourceGroupName, kustoPoolName, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + public static void Delete(this IKustoPoolsOperations operations, string workspaceName, string resourceGroupName, string kustoPoolName) + { + operations.DeleteAsync(workspaceName, resourceGroupName, kustoPoolName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IKustoPoolsOperations operations, string workspaceName, string resourceGroupName, string kustoPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(workspaceName, resourceGroupName, kustoPoolName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Stops a Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static void Stop(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName) + { + operations.StopAsync(workspaceName, kustoPoolName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Stops a Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task StopAsync(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StopWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts a Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static void Start(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName) + { + operations.StartAsync(workspaceName, kustoPoolName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Starts a Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task StartAsync(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StartWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns the SKUs available for the provided resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IEnumerable ListSkusByResource(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName) + { + return operations.ListSkusByResourceAsync(workspaceName, kustoPoolName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Returns the SKUs available for the provided resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListSkusByResourceAsync(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListSkusByResourceWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns a list of language extensions that can run within KQL queries. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IEnumerable ListLanguageExtensions(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName) + { + return operations.ListLanguageExtensionsAsync(workspaceName, kustoPoolName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of language extensions that can run within KQL queries. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListLanguageExtensionsAsync(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListLanguageExtensionsWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Add a list of language extensions that can run within KQL queries. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The language extensions to add. + /// + public static void AddLanguageExtensions(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, LanguageExtensionsList languageExtensionsToAdd) + { + operations.AddLanguageExtensionsAsync(workspaceName, kustoPoolName, resourceGroupName, languageExtensionsToAdd).GetAwaiter().GetResult(); + } + + /// + /// Add a list of language extensions that can run within KQL queries. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The language extensions to add. + /// + /// + /// The cancellation token. + /// + public static async Task AddLanguageExtensionsAsync(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, LanguageExtensionsList languageExtensionsToAdd, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.AddLanguageExtensionsWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, languageExtensionsToAdd, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Remove a list of language extensions that can run within KQL queries. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The language extensions to remove. + /// + public static void RemoveLanguageExtensions(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, LanguageExtensionsList languageExtensionsToRemove) + { + operations.RemoveLanguageExtensionsAsync(workspaceName, kustoPoolName, resourceGroupName, languageExtensionsToRemove).GetAwaiter().GetResult(); + } + + /// + /// Remove a list of language extensions that can run within KQL queries. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The language extensions to remove. + /// + /// + /// The cancellation token. + /// + public static async Task RemoveLanguageExtensionsAsync(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, LanguageExtensionsList languageExtensionsToRemove, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RemoveLanguageExtensionsWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, languageExtensionsToRemove, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns a list of databases that are owned by this Kusto Pool and were + /// followed by another Kusto Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IEnumerable ListFollowerDatabases(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName) + { + return operations.ListFollowerDatabasesAsync(workspaceName, kustoPoolName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of databases that are owned by this Kusto Pool and were + /// followed by another Kusto Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListFollowerDatabasesAsync(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListFollowerDatabasesWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Detaches all followers of a database owned by this Kusto Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The follower databases properties to remove. + /// + public static void DetachFollowerDatabases(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, FollowerDatabaseDefinition followerDatabaseToRemove) + { + operations.DetachFollowerDatabasesAsync(workspaceName, kustoPoolName, resourceGroupName, followerDatabaseToRemove).GetAwaiter().GetResult(); + } + + /// + /// Detaches all followers of a database owned by this Kusto Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The follower databases properties to remove. + /// + /// + /// The cancellation token. + /// + public static async Task DetachFollowerDatabasesAsync(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, FollowerDatabaseDefinition followerDatabaseToRemove, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DetachFollowerDatabasesWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, followerDatabaseToRemove, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create or update a Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The Kusto pool parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The ETag of the Kusto Pool. Omit this value to always overwrite the current + /// Kusto Pool. Specify the last-seen ETag value to prevent accidentally + /// overwriting concurrent changes. + /// + /// + /// Set to '*' to allow a new Kusto Pool to be created, but to prevent updating + /// an existing Kusto Pool. Other values will result in a 412 Pre-condition + /// Failed response. + /// + public static KustoPool BeginCreateOrUpdate(this IKustoPoolsOperations operations, string workspaceName, string resourceGroupName, string kustoPoolName, KustoPool parameters, string ifMatch = default(string), string ifNoneMatch = default(string)) + { + return operations.BeginCreateOrUpdateAsync(workspaceName, resourceGroupName, kustoPoolName, parameters, ifMatch, ifNoneMatch).GetAwaiter().GetResult(); + } + + /// + /// Create or update a Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The Kusto pool parameters supplied to the CreateOrUpdate operation. + /// + /// + /// The ETag of the Kusto Pool. Omit this value to always overwrite the current + /// Kusto Pool. Specify the last-seen ETag value to prevent accidentally + /// overwriting concurrent changes. + /// + /// + /// Set to '*' to allow a new Kusto Pool to be created, but to prevent updating + /// an existing Kusto Pool. Other values will result in a 412 Pre-condition + /// Failed response. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IKustoPoolsOperations operations, string workspaceName, string resourceGroupName, string kustoPoolName, KustoPool parameters, string ifMatch = default(string), string ifNoneMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(workspaceName, resourceGroupName, kustoPoolName, parameters, ifMatch, ifNoneMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a Kusto Kusto Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The Kusto pool parameters supplied to the Update operation. + /// + /// + /// The ETag of the Kusto Pool. Omit this value to always overwrite the current + /// Kusto Pool. Specify the last-seen ETag value to prevent accidentally + /// overwriting concurrent changes. + /// + public static KustoPool BeginUpdate(this IKustoPoolsOperations operations, string workspaceName, string resourceGroupName, string kustoPoolName, KustoPoolUpdate parameters, string ifMatch = default(string)) + { + return operations.BeginUpdateAsync(workspaceName, resourceGroupName, kustoPoolName, parameters, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Update a Kusto Kusto Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The Kusto pool parameters supplied to the Update operation. + /// + /// + /// The ETag of the Kusto Pool. Omit this value to always overwrite the current + /// Kusto Pool. Specify the last-seen ETag value to prevent accidentally + /// overwriting concurrent changes. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IKustoPoolsOperations operations, string workspaceName, string resourceGroupName, string kustoPoolName, KustoPoolUpdate parameters, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(workspaceName, resourceGroupName, kustoPoolName, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + public static void BeginDelete(this IKustoPoolsOperations operations, string workspaceName, string resourceGroupName, string kustoPoolName) + { + operations.BeginDeleteAsync(workspaceName, resourceGroupName, kustoPoolName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IKustoPoolsOperations operations, string workspaceName, string resourceGroupName, string kustoPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(workspaceName, resourceGroupName, kustoPoolName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Stops a Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static void BeginStop(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName) + { + operations.BeginStopAsync(workspaceName, kustoPoolName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Stops a Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStopAsync(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStopWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Starts a Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static void BeginStart(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName) + { + operations.BeginStartAsync(workspaceName, kustoPoolName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Starts a Kusto pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task BeginStartAsync(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginStartWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Add a list of language extensions that can run within KQL queries. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The language extensions to add. + /// + public static void BeginAddLanguageExtensions(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, LanguageExtensionsList languageExtensionsToAdd) + { + operations.BeginAddLanguageExtensionsAsync(workspaceName, kustoPoolName, resourceGroupName, languageExtensionsToAdd).GetAwaiter().GetResult(); + } + + /// + /// Add a list of language extensions that can run within KQL queries. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The language extensions to add. + /// + /// + /// The cancellation token. + /// + public static async Task BeginAddLanguageExtensionsAsync(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, LanguageExtensionsList languageExtensionsToAdd, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginAddLanguageExtensionsWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, languageExtensionsToAdd, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Remove a list of language extensions that can run within KQL queries. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The language extensions to remove. + /// + public static void BeginRemoveLanguageExtensions(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, LanguageExtensionsList languageExtensionsToRemove) + { + operations.BeginRemoveLanguageExtensionsAsync(workspaceName, kustoPoolName, resourceGroupName, languageExtensionsToRemove).GetAwaiter().GetResult(); + } + + /// + /// Remove a list of language extensions that can run within KQL queries. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The language extensions to remove. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRemoveLanguageExtensionsAsync(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, LanguageExtensionsList languageExtensionsToRemove, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRemoveLanguageExtensionsWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, languageExtensionsToRemove, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Detaches all followers of a database owned by this Kusto Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The follower databases properties to remove. + /// + public static void BeginDetachFollowerDatabases(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, FollowerDatabaseDefinition followerDatabaseToRemove) + { + operations.BeginDetachFollowerDatabasesAsync(workspaceName, kustoPoolName, resourceGroupName, followerDatabaseToRemove).GetAwaiter().GetResult(); + } + + /// + /// Detaches all followers of a database owned by this Kusto Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the workspace + /// + /// + /// The name of the Kusto pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The follower databases properties to remove. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDetachFollowerDatabasesAsync(this IKustoPoolsOperations operations, string workspaceName, string kustoPoolName, string resourceGroupName, FollowerDatabaseDefinition followerDatabaseToRemove, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDetachFollowerDatabasesWithHttpMessagesAsync(workspaceName, kustoPoolName, resourceGroupName, followerDatabaseToRemove, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AttachedDatabaseConfiguration.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AttachedDatabaseConfiguration.cs new file mode 100644 index 000000000000..275c3b01ab6e --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AttachedDatabaseConfiguration.cs @@ -0,0 +1,161 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Class representing an attached database configuration. + /// + [Rest.Serialization.JsonTransformation] + public partial class AttachedDatabaseConfiguration : ProxyResource + { + /// + /// Initializes a new instance of the AttachedDatabaseConfiguration + /// class. + /// + public AttachedDatabaseConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AttachedDatabaseConfiguration + /// class. + /// + /// The name of the database which you would + /// like to attach, use * if you want to follow all current and future + /// databases. + /// The resource id of the kusto pool + /// where the databases you would like to attach reside. + /// The default + /// principals modification kind. Possible values include: 'Union', + /// 'Replace', 'None' + /// 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" + /// Resource location. + /// The provisioned state of the + /// resource. Possible values include: 'Running', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Moving', 'Canceled' + /// The list of databases from the + /// clusterResourceId which are currently attached to the kusto + /// pool. + /// Table level sharing + /// specifications + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public AttachedDatabaseConfiguration(string databaseName, string kustoPoolResourceId, string defaultPrincipalsModificationKind, string id = default(string), string name = default(string), string type = default(string), string location = default(string), string provisioningState = default(string), IList attachedDatabaseNames = default(IList), TableLevelSharingProperties tableLevelSharingProperties = default(TableLevelSharingProperties), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + Location = location; + ProvisioningState = provisioningState; + DatabaseName = databaseName; + KustoPoolResourceId = kustoPoolResourceId; + AttachedDatabaseNames = attachedDatabaseNames; + DefaultPrincipalsModificationKind = defaultPrincipalsModificationKind; + TableLevelSharingProperties = tableLevelSharingProperties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets the provisioned state of the resource. Possible values + /// include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', + /// 'Moving', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets the name of the database which you would like to + /// attach, use * if you want to follow all current and future + /// databases. + /// + [JsonProperty(PropertyName = "properties.databaseName")] + public string DatabaseName { get; set; } + + /// + /// Gets or sets the resource id of the kusto pool where the databases + /// you would like to attach reside. + /// + [JsonProperty(PropertyName = "properties.clusterResourceId")] + public string KustoPoolResourceId { get; set; } + + /// + /// Gets the list of databases from the clusterResourceId which are + /// currently attached to the kusto pool. + /// + [JsonProperty(PropertyName = "properties.attachedDatabaseNames")] + public IList AttachedDatabaseNames { get; private set; } + + /// + /// Gets or sets the default principals modification kind. Possible + /// values include: 'Union', 'Replace', 'None' + /// + [JsonProperty(PropertyName = "properties.defaultPrincipalsModificationKind")] + public string DefaultPrincipalsModificationKind { get; set; } + + /// + /// Gets or sets table level sharing specifications + /// + [JsonProperty(PropertyName = "properties.tableLevelSharingProperties")] + public TableLevelSharingProperties TableLevelSharingProperties { get; set; } + + /// + /// Gets azure Resource Manager metadata containing createdBy and + /// modifiedBy information. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DatabaseName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DatabaseName"); + } + if (KustoPoolResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KustoPoolResourceId"); + } + if (DefaultPrincipalsModificationKind == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DefaultPrincipalsModificationKind"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AzureCapacity.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AzureCapacity.cs new file mode 100644 index 000000000000..0886109535bd --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AzureCapacity.cs @@ -0,0 +1,92 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure capacity definition. + /// + public partial class AzureCapacity + { + /// + /// Initializes a new instance of the AzureCapacity class. + /// + public AzureCapacity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureCapacity class. + /// + /// Scale type. Possible values include: + /// 'automatic', 'manual', 'none' + /// Minimum allowed capacity. + /// Maximum allowed capacity. + /// The default capacity that would be + /// used. + public AzureCapacity(string scaleType, int minimum, int maximum, int defaultProperty) + { + ScaleType = scaleType; + Minimum = minimum; + Maximum = maximum; + DefaultProperty = defaultProperty; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets scale type. Possible values include: 'automatic', + /// 'manual', 'none' + /// + [JsonProperty(PropertyName = "scaleType")] + public string ScaleType { get; set; } + + /// + /// Gets or sets minimum allowed capacity. + /// + [JsonProperty(PropertyName = "minimum")] + public int Minimum { get; set; } + + /// + /// Gets or sets maximum allowed capacity. + /// + [JsonProperty(PropertyName = "maximum")] + public int Maximum { get; set; } + + /// + /// Gets or sets the default capacity that would be used. + /// + [JsonProperty(PropertyName = "default")] + public int DefaultProperty { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ScaleType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ScaleType"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AzureResourceSku.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AzureResourceSku.cs new file mode 100644 index 000000000000..5e103bf11569 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AzureResourceSku.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure resource SKU definition. + /// + public partial class AzureResourceSku + { + /// + /// Initializes a new instance of the AzureResourceSku class. + /// + public AzureResourceSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureResourceSku class. + /// + /// Resource Namespace and Type. + /// The SKU details. + /// The number of instances of the + /// cluster. + public AzureResourceSku(string resourceType = default(string), AzureSku sku = default(AzureSku), AzureCapacity capacity = default(AzureCapacity)) + { + ResourceType = resourceType; + Sku = sku; + Capacity = capacity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource Namespace and Type. + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; set; } + + /// + /// Gets or sets the SKU details. + /// + [JsonProperty(PropertyName = "sku")] + public AzureSku Sku { get; set; } + + /// + /// Gets or sets the number of instances of the cluster. + /// + [JsonProperty(PropertyName = "capacity")] + public AzureCapacity Capacity { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Sku != null) + { + Sku.Validate(); + } + if (Capacity != null) + { + Capacity.Validate(); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AzureScaleType.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AzureScaleType.cs new file mode 100644 index 000000000000..e94f60afafc3 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AzureScaleType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + + /// + /// Defines values for AzureScaleType. + /// + public static class AzureScaleType + { + public const string Automatic = "automatic"; + public const string Manual = "manual"; + public const string None = "none"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AzureSku.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AzureSku.cs new file mode 100644 index 000000000000..758f98ee0476 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/AzureSku.cs @@ -0,0 +1,90 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure SKU definition. + /// + public partial class AzureSku + { + /// + /// Initializes a new instance of the AzureSku class. + /// + public AzureSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureSku class. + /// + /// SKU name. Possible values include: 'Compute + /// optimized', 'Storage optimized' + /// SKU size. Possible values include: 'Extra + /// small', 'Small', 'Medium', 'Large' + /// The number of instances of the + /// cluster. + public AzureSku(string name, string size, int? capacity = default(int?)) + { + Name = name; + Capacity = capacity; + Size = size; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets SKU name. Possible values include: 'Compute + /// optimized', 'Storage optimized' + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the number of instances of the cluster. + /// + [JsonProperty(PropertyName = "capacity")] + public int? Capacity { get; set; } + + /// + /// Gets or sets SKU size. Possible values include: 'Extra small', + /// 'Small', 'Medium', 'Large' + /// + [JsonProperty(PropertyName = "size")] + public string Size { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Size == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Size"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/BlobStorageEventType.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/BlobStorageEventType.cs new file mode 100644 index 000000000000..9bda6f87b235 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/BlobStorageEventType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + + /// + /// Defines values for BlobStorageEventType. + /// + public static class BlobStorageEventType + { + public const string MicrosoftStorageBlobCreated = "Microsoft.Storage.BlobCreated"; + public const string MicrosoftStorageBlobRenamed = "Microsoft.Storage.BlobRenamed"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/CheckNameResult.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/CheckNameResult.cs new file mode 100644 index 000000000000..9b7dd1a9964a --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/CheckNameResult.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The result returned from a check name availability request. + /// + public partial class CheckNameResult + { + /// + /// Initializes a new instance of the CheckNameResult class. + /// + public CheckNameResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckNameResult class. + /// + /// Specifies a Boolean value that + /// indicates if the name is available. + /// The name that was checked. + /// Message indicating an unavailable name due to + /// a conflict, or a description of the naming rules that are + /// violated. + /// Message providing the reason why the given + /// name is invalid. Possible values include: 'Invalid', + /// 'AlreadyExists' + public CheckNameResult(bool? nameAvailable = default(bool?), string name = default(string), string message = default(string), string reason = default(string)) + { + NameAvailable = nameAvailable; + Name = name; + Message = message; + Reason = reason; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies a Boolean value that indicates if the name + /// is available. + /// + [JsonProperty(PropertyName = "nameAvailable")] + public bool? NameAvailable { get; set; } + + /// + /// Gets or sets the name that was checked. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets message indicating an unavailable name due to a + /// conflict, or a description of the naming rules that are violated. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets message providing the reason why the given name is + /// invalid. Possible values include: 'Invalid', 'AlreadyExists' + /// + [JsonProperty(PropertyName = "reason")] + public string Reason { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ClusterPrincipalAssignment.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ClusterPrincipalAssignment.cs new file mode 100644 index 000000000000..0701f58b0a5c --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ClusterPrincipalAssignment.cs @@ -0,0 +1,151 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Class representing a cluster principal assignment. + /// + [Rest.Serialization.JsonTransformation] + public partial class ClusterPrincipalAssignment : ProxyResource + { + /// + /// Initializes a new instance of the ClusterPrincipalAssignment class. + /// + public ClusterPrincipalAssignment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ClusterPrincipalAssignment class. + /// + /// The principal ID assigned to the cluster + /// principal. It can be a user email, application ID, or security + /// group name. + /// Cluster principal role. Possible values include: + /// 'AllDatabasesAdmin', 'AllDatabasesViewer' + /// Principal type. Possible values + /// include: 'App', 'Group', 'User' + /// 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 tenant id of the principal + /// The tenant name of the principal + /// The principal name + /// The provisioned state of the + /// resource. Possible values include: 'Running', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Moving', 'Canceled' + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public ClusterPrincipalAssignment(string principalId, string role, string principalType, string id = default(string), string name = default(string), string type = default(string), string tenantId = default(string), string tenantName = default(string), string principalName = default(string), string provisioningState = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + PrincipalId = principalId; + Role = role; + TenantId = tenantId; + PrincipalType = principalType; + TenantName = tenantName; + PrincipalName = principalName; + ProvisioningState = provisioningState; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the principal ID assigned to the cluster principal. It + /// can be a user email, application ID, or security group name. + /// + [JsonProperty(PropertyName = "properties.principalId")] + public string PrincipalId { get; set; } + + /// + /// Gets or sets cluster principal role. Possible values include: + /// 'AllDatabasesAdmin', 'AllDatabasesViewer' + /// + [JsonProperty(PropertyName = "properties.role")] + public string Role { get; set; } + + /// + /// Gets or sets the tenant id of the principal + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets principal type. Possible values include: 'App', + /// 'Group', 'User' + /// + [JsonProperty(PropertyName = "properties.principalType")] + public string PrincipalType { get; set; } + + /// + /// Gets the tenant name of the principal + /// + [JsonProperty(PropertyName = "properties.tenantName")] + public string TenantName { get; private set; } + + /// + /// Gets the principal name + /// + [JsonProperty(PropertyName = "properties.principalName")] + public string PrincipalName { get; private set; } + + /// + /// Gets or sets the provisioned state of the resource. Possible values + /// include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', + /// 'Moving', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets azure Resource Manager metadata containing createdBy and + /// modifiedBy information. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PrincipalId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrincipalId"); + } + if (Role == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Role"); + } + if (PrincipalType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrincipalType"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ClusterPrincipalAssignmentCheckNameRequest.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ClusterPrincipalAssignmentCheckNameRequest.cs new file mode 100644 index 000000000000..84c7e4739dc3 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ClusterPrincipalAssignmentCheckNameRequest.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A principal assignment check name availability request. + /// + public partial class ClusterPrincipalAssignmentCheckNameRequest + { + /// + /// Initializes a new instance of the + /// ClusterPrincipalAssignmentCheckNameRequest class. + /// + public ClusterPrincipalAssignmentCheckNameRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ClusterPrincipalAssignmentCheckNameRequest class. + /// + /// Principal Assignment resource name. + public ClusterPrincipalAssignmentCheckNameRequest(string name) + { + Name = name; + CustomInit(); + } + /// + /// Static constructor for ClusterPrincipalAssignmentCheckNameRequest + /// class. + /// + static ClusterPrincipalAssignmentCheckNameRequest() + { + Type = "Microsoft.Synapse/workspaces/kustoPools/principalAssignments"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets principal Assignment resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// The type of resource, + /// Microsoft.Synapse/workspaces/kustoPools/principalAssignments. + /// + [JsonProperty(PropertyName = "type")] + public static string Type { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ClusterPrincipalRole.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ClusterPrincipalRole.cs new file mode 100644 index 000000000000..21697c764f3a --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ClusterPrincipalRole.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + + /// + /// Defines values for ClusterPrincipalRole. + /// + public static class ClusterPrincipalRole + { + public const string AllDatabasesAdmin = "AllDatabasesAdmin"; + public const string AllDatabasesViewer = "AllDatabasesViewer"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Compression.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Compression.cs new file mode 100644 index 000000000000..a509f4ead60e --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Compression.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + + /// + /// Defines values for Compression. + /// + public static class Compression + { + public const string None = "None"; + public const string GZip = "GZip"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/CreateMode.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/CreateMode.cs new file mode 100644 index 000000000000..d50fd6d272d5 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/CreateMode.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + + /// + /// Defines values for CreateMode. + /// + public static class CreateMode + { + public const string Default = "Default"; + public const string PointInTimeRestore = "PointInTimeRestore"; + public const string Recovery = "Recovery"; + public const string Restore = "Restore"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/CreatedByType.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/CreatedByType.cs new file mode 100644 index 000000000000..89fe012d60f9 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/CreatedByType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + + /// + /// Defines values for CreatedByType. + /// + public static class CreatedByType + { + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataConnection.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataConnection.cs new file mode 100644 index 000000000000..7defc0c426ab --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataConnection.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Class representing a data connection. + /// + public partial class DataConnection : ProxyResource + { + /// + /// Initializes a new instance of the DataConnection class. + /// + public DataConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataConnection 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" + /// Resource location. + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public DataConnection(string id = default(string), string name = default(string), string type = default(string), string location = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + Location = location; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets azure Resource Manager metadata containing createdBy and + /// modifiedBy information. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataConnectionCheckNameRequest.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataConnectionCheckNameRequest.cs new file mode 100644 index 000000000000..b932666e1c3a --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataConnectionCheckNameRequest.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A data connection check name availability request. + /// + public partial class DataConnectionCheckNameRequest + { + /// + /// Initializes a new instance of the DataConnectionCheckNameRequest + /// class. + /// + public DataConnectionCheckNameRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataConnectionCheckNameRequest + /// class. + /// + /// Data Connection name. + public DataConnectionCheckNameRequest(string name) + { + Name = name; + CustomInit(); + } + /// + /// Static constructor for DataConnectionCheckNameRequest class. + /// + static DataConnectionCheckNameRequest() + { + Type = "Microsoft.Synapse/workspaces/kustoPools/databases/dataConnections"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets data Connection name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// The type of resource, + /// Microsoft.Synapse/workspaces/kustoPools/databases/dataConnections. + /// + [JsonProperty(PropertyName = "type")] + public static string Type { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataConnectionValidation.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataConnectionValidation.cs new file mode 100644 index 000000000000..2bfc3e460002 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataConnectionValidation.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Class representing an data connection validation. + /// + public partial class DataConnectionValidation + { + /// + /// Initializes a new instance of the DataConnectionValidation class. + /// + public DataConnectionValidation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataConnectionValidation class. + /// + /// The name of the data + /// connection. + /// The data connection properties to + /// validate. + public DataConnectionValidation(string dataConnectionName = default(string), DataConnection properties = default(DataConnection)) + { + DataConnectionName = dataConnectionName; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the data connection. + /// + [JsonProperty(PropertyName = "dataConnectionName")] + public string DataConnectionName { get; set; } + + /// + /// Gets or sets the data connection properties to validate. + /// + [JsonProperty(PropertyName = "properties")] + public DataConnection Properties { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataConnectionValidationListResult.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataConnectionValidationListResult.cs new file mode 100644 index 000000000000..9bf8cde4515b --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataConnectionValidationListResult.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The list Kusto data connection validation result. + /// + public partial class DataConnectionValidationListResult + { + /// + /// Initializes a new instance of the + /// DataConnectionValidationListResult class. + /// + public DataConnectionValidationListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// DataConnectionValidationListResult class. + /// + /// The list of Kusto data connection validation + /// errors. + public DataConnectionValidationListResult(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 Kusto data connection validation errors. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataConnectionValidationResult.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataConnectionValidationResult.cs new file mode 100644 index 000000000000..aeeb3d5a1170 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DataConnectionValidationResult.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The result returned from a data connection validation request. + /// + public partial class DataConnectionValidationResult + { + /// + /// Initializes a new instance of the DataConnectionValidationResult + /// class. + /// + public DataConnectionValidationResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataConnectionValidationResult + /// class. + /// + /// A message which indicates a problem in + /// data connection validation. + public DataConnectionValidationResult(string errorMessage = default(string)) + { + ErrorMessage = errorMessage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a message which indicates a problem in data connection + /// validation. + /// + [JsonProperty(PropertyName = "errorMessage")] + public string ErrorMessage { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Database.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Database.cs new file mode 100644 index 000000000000..8ce2c05d2daf --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Database.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Class representing a Kusto database. + /// + public partial class Database : ProxyResource + { + /// + /// Initializes a new instance of the Database class. + /// + public Database() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Database 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" + /// Resource location. + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public Database(string id = default(string), string name = default(string), string type = default(string), string location = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + Location = location; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets azure Resource Manager metadata containing createdBy and + /// modifiedBy information. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DatabaseCheckNameRequest.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DatabaseCheckNameRequest.cs new file mode 100644 index 000000000000..ee4653bed7d6 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DatabaseCheckNameRequest.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The result returned from a database check name availability request. + /// + public partial class DatabaseCheckNameRequest + { + /// + /// Initializes a new instance of the DatabaseCheckNameRequest class. + /// + public DatabaseCheckNameRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseCheckNameRequest class. + /// + /// Resource name. + /// The type of resource, for instance + /// Microsoft.Synapse/workspaces/kustoPools/databases. Possible values + /// include: 'Microsoft.Synapse/workspaces/kustoPools/databases', + /// 'Microsoft.Synapse/workspaces/kustoPools/attachedDatabaseConfigurations' + public DatabaseCheckNameRequest(string name, Type type) + { + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the type of resource, for instance + /// Microsoft.Synapse/workspaces/kustoPools/databases. Possible values + /// include: 'Microsoft.Synapse/workspaces/kustoPools/databases', + /// 'Microsoft.Synapse/workspaces/kustoPools/attachedDatabaseConfigurations' + /// + [JsonProperty(PropertyName = "type")] + public Type Type { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DatabasePrincipalAssignment.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DatabasePrincipalAssignment.cs new file mode 100644 index 000000000000..abcea53f94ce --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DatabasePrincipalAssignment.cs @@ -0,0 +1,155 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Class representing a database principal assignment. + /// + [Rest.Serialization.JsonTransformation] + public partial class DatabasePrincipalAssignment : ProxyResource + { + /// + /// Initializes a new instance of the DatabasePrincipalAssignment + /// class. + /// + public DatabasePrincipalAssignment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabasePrincipalAssignment + /// class. + /// + /// The principal ID assigned to the database + /// principal. It can be a user email, application ID, or security + /// group name. + /// Database principal role. Possible values + /// include: 'Admin', 'Ingestor', 'Monitor', 'User', + /// 'UnrestrictedViewer', 'Viewer' + /// Principal type. Possible values + /// include: 'App', 'Group', 'User' + /// 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 tenant id of the principal + /// The tenant name of the principal + /// The principal name + /// The provisioned state of the + /// resource. Possible values include: 'Running', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Moving', 'Canceled' + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public DatabasePrincipalAssignment(string principalId, string role, string principalType, string id = default(string), string name = default(string), string type = default(string), string tenantId = default(string), string tenantName = default(string), string principalName = default(string), string provisioningState = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type) + { + PrincipalId = principalId; + Role = role; + TenantId = tenantId; + PrincipalType = principalType; + TenantName = tenantName; + PrincipalName = principalName; + ProvisioningState = provisioningState; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the principal ID assigned to the database principal. + /// It can be a user email, application ID, or security group name. + /// + [JsonProperty(PropertyName = "properties.principalId")] + public string PrincipalId { get; set; } + + /// + /// Gets or sets database principal role. Possible values include: + /// 'Admin', 'Ingestor', 'Monitor', 'User', 'UnrestrictedViewer', + /// 'Viewer' + /// + [JsonProperty(PropertyName = "properties.role")] + public string Role { get; set; } + + /// + /// Gets or sets the tenant id of the principal + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets principal type. Possible values include: 'App', + /// 'Group', 'User' + /// + [JsonProperty(PropertyName = "properties.principalType")] + public string PrincipalType { get; set; } + + /// + /// Gets the tenant name of the principal + /// + [JsonProperty(PropertyName = "properties.tenantName")] + public string TenantName { get; private set; } + + /// + /// Gets the principal name + /// + [JsonProperty(PropertyName = "properties.principalName")] + public string PrincipalName { get; private set; } + + /// + /// Gets or sets the provisioned state of the resource. Possible values + /// include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', + /// 'Moving', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets azure Resource Manager metadata containing createdBy and + /// modifiedBy information. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PrincipalId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrincipalId"); + } + if (Role == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Role"); + } + if (PrincipalType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrincipalType"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DatabasePrincipalAssignmentCheckNameRequest.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DatabasePrincipalAssignmentCheckNameRequest.cs new file mode 100644 index 000000000000..8e3f44c20114 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DatabasePrincipalAssignmentCheckNameRequest.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A principal assignment check name availability request. + /// + public partial class DatabasePrincipalAssignmentCheckNameRequest + { + /// + /// Initializes a new instance of the + /// DatabasePrincipalAssignmentCheckNameRequest class. + /// + public DatabasePrincipalAssignmentCheckNameRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// DatabasePrincipalAssignmentCheckNameRequest class. + /// + /// Principal Assignment resource name. + public DatabasePrincipalAssignmentCheckNameRequest(string name) + { + Name = name; + CustomInit(); + } + /// + /// Static constructor for DatabasePrincipalAssignmentCheckNameRequest + /// class. + /// + static DatabasePrincipalAssignmentCheckNameRequest() + { + Type = "Microsoft.Synapse/workspaces/kustoPools/databases/principalAssignments"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets principal Assignment resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// The type of resource, + /// Microsoft.Synapse/workspaces/kustoPools/databases/principalAssignments. + /// + [JsonProperty(PropertyName = "type")] + public static string Type { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DatabasePrincipalRole.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DatabasePrincipalRole.cs new file mode 100644 index 000000000000..99d8f037d479 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DatabasePrincipalRole.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + + /// + /// Defines values for DatabasePrincipalRole. + /// + public static class DatabasePrincipalRole + { + public const string Admin = "Admin"; + public const string Ingestor = "Ingestor"; + public const string Monitor = "Monitor"; + public const string User = "User"; + public const string UnrestrictedViewer = "UnrestrictedViewer"; + public const string Viewer = "Viewer"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DatabaseStatistics.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DatabaseStatistics.cs new file mode 100644 index 000000000000..4e7362e7736f --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DatabaseStatistics.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A class that contains database statistics information. + /// + public partial class DatabaseStatistics + { + /// + /// Initializes a new instance of the DatabaseStatistics class. + /// + public DatabaseStatistics() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseStatistics class. + /// + /// The database size - the total size of compressed + /// data and index in bytes. + public DatabaseStatistics(double? size = default(double?)) + { + Size = size; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the database size - the total size of compressed data + /// and index in bytes. + /// + [JsonProperty(PropertyName = "size")] + public double? Size { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DatabaseStatus.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DatabaseStatus.cs new file mode 100644 index 000000000000..84766d7923c3 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DatabaseStatus.cs @@ -0,0 +1,41 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + + /// + /// Defines values for DatabaseStatus. + /// + public static class DatabaseStatus + { + public const string Online = "Online"; + public const string Restoring = "Restoring"; + public const string RecoveryPending = "RecoveryPending"; + public const string Recovering = "Recovering"; + public const string Suspect = "Suspect"; + public const string Offline = "Offline"; + public const string Standby = "Standby"; + public const string Shutdown = "Shutdown"; + public const string EmergencyMode = "EmergencyMode"; + public const string AutoClosed = "AutoClosed"; + public const string Copying = "Copying"; + public const string Creating = "Creating"; + public const string Inaccessible = "Inaccessible"; + public const string OfflineSecondary = "OfflineSecondary"; + public const string Pausing = "Pausing"; + public const string Paused = "Paused"; + public const string Resuming = "Resuming"; + public const string Scaling = "Scaling"; + public const string OfflineChangingDwPerformanceTiers = "OfflineChangingDwPerformanceTiers"; + public const string OnlineChangingDwPerformanceTiers = "OnlineChangingDwPerformanceTiers"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DefaultPrincipalsModificationKind.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DefaultPrincipalsModificationKind.cs new file mode 100644 index 000000000000..630945075637 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/DefaultPrincipalsModificationKind.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + + /// + /// Defines values for DefaultPrincipalsModificationKind. + /// + public static class DefaultPrincipalsModificationKind + { + public const string Union = "Union"; + public const string Replace = "Replace"; + public const string None = "None"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/EventGridDataConnection.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/EventGridDataConnection.cs new file mode 100644 index 000000000000..57df8f12b801 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/EventGridDataConnection.cs @@ -0,0 +1,180 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Class representing an Event Grid data connection. + /// + [Newtonsoft.Json.JsonObject("EventGrid")] + [Rest.Serialization.JsonTransformation] + public partial class EventGridDataConnection : DataConnection + { + /// + /// Initializes a new instance of the EventGridDataConnection class. + /// + public EventGridDataConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EventGridDataConnection class. + /// + /// The resource ID of the + /// storage account where the data resides. + /// The resource ID where the event + /// grid is configured to send events. + /// The event hub consumer group. + /// 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" + /// Resource location. + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// The table where the data should be + /// ingested. Optionally the table information can be added to each + /// message. + /// The mapping rule to be used to ingest + /// the data. Optionally the mapping information can be added to each + /// message. + /// The data format of the message. Optionally + /// the data format can be added to each message. Possible values + /// include: 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', + /// 'TXT', 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE', 'PARQUET', 'ORC', + /// 'APACHEAVRO', 'W3CLOGFILE' + /// A Boolean value that, if set to + /// true, indicates that ingestion should ignore the first record of + /// every file + /// The name of blob storage event + /// type to process. Possible values include: + /// 'Microsoft.Storage.BlobCreated', + /// 'Microsoft.Storage.BlobRenamed' + /// The provisioned state of the + /// resource. Possible values include: 'Running', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Moving', 'Canceled' + public EventGridDataConnection(string storageAccountResourceId, string eventHubResourceId, string consumerGroup, string id = default(string), string name = default(string), string type = default(string), string location = default(string), SystemData systemData = default(SystemData), string tableName = default(string), string mappingRuleName = default(string), string dataFormat = default(string), bool? ignoreFirstRecord = default(bool?), string blobStorageEventType = default(string), string provisioningState = default(string)) + : base(id, name, type, location, systemData) + { + StorageAccountResourceId = storageAccountResourceId; + EventHubResourceId = eventHubResourceId; + ConsumerGroup = consumerGroup; + TableName = tableName; + MappingRuleName = mappingRuleName; + DataFormat = dataFormat; + IgnoreFirstRecord = ignoreFirstRecord; + BlobStorageEventType = blobStorageEventType; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource ID of the storage account where the data + /// resides. + /// + [JsonProperty(PropertyName = "properties.storageAccountResourceId")] + public string StorageAccountResourceId { get; set; } + + /// + /// Gets or sets the resource ID where the event grid is configured to + /// send events. + /// + [JsonProperty(PropertyName = "properties.eventHubResourceId")] + public string EventHubResourceId { get; set; } + + /// + /// Gets or sets the event hub consumer group. + /// + [JsonProperty(PropertyName = "properties.consumerGroup")] + public string ConsumerGroup { get; set; } + + /// + /// Gets or sets the table where the data should be ingested. + /// Optionally the table information can be added to each message. + /// + [JsonProperty(PropertyName = "properties.tableName")] + public string TableName { get; set; } + + /// + /// Gets or sets the mapping rule to be used to ingest the data. + /// Optionally the mapping information can be added to each message. + /// + [JsonProperty(PropertyName = "properties.mappingRuleName")] + public string MappingRuleName { get; set; } + + /// + /// Gets or sets the data format of the message. Optionally the data + /// format can be added to each message. Possible values include: + /// 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', + /// 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE', 'PARQUET', 'ORC', + /// 'APACHEAVRO', 'W3CLOGFILE' + /// + [JsonProperty(PropertyName = "properties.dataFormat")] + public string DataFormat { get; set; } + + /// + /// Gets or sets a Boolean value that, if set to true, indicates that + /// ingestion should ignore the first record of every file + /// + [JsonProperty(PropertyName = "properties.ignoreFirstRecord")] + public bool? IgnoreFirstRecord { get; set; } + + /// + /// Gets or sets the name of blob storage event type to process. + /// Possible values include: 'Microsoft.Storage.BlobCreated', + /// 'Microsoft.Storage.BlobRenamed' + /// + [JsonProperty(PropertyName = "properties.blobStorageEventType")] + public string BlobStorageEventType { get; set; } + + /// + /// Gets or sets the provisioned state of the resource. Possible values + /// include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', + /// 'Moving', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StorageAccountResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StorageAccountResourceId"); + } + if (EventHubResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "EventHubResourceId"); + } + if (ConsumerGroup == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ConsumerGroup"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/EventGridDataFormat.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/EventGridDataFormat.cs new file mode 100644 index 000000000000..acf262e4a1ec --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/EventGridDataFormat.cs @@ -0,0 +1,36 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + + /// + /// Defines values for EventGridDataFormat. + /// + public static class EventGridDataFormat + { + public const string MULTIJSON = "MULTIJSON"; + public const string JSON = "JSON"; + public const string CSV = "CSV"; + public const string TSV = "TSV"; + public const string SCSV = "SCSV"; + public const string SOHSV = "SOHSV"; + public const string PSV = "PSV"; + public const string TXT = "TXT"; + public const string RAW = "RAW"; + public const string SINGLEJSON = "SINGLEJSON"; + public const string AVRO = "AVRO"; + public const string TSVE = "TSVE"; + public const string PARQUET = "PARQUET"; + public const string ORC = "ORC"; + public const string APACHEAVRO = "APACHEAVRO"; + public const string W3CLOGFILE = "W3CLOGFILE"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/EventHubDataConnection.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/EventHubDataConnection.cs new file mode 100644 index 000000000000..f7c7e296afdb --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/EventHubDataConnection.cs @@ -0,0 +1,174 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Class representing an event hub data connection. + /// + [Newtonsoft.Json.JsonObject("EventHub")] + [Rest.Serialization.JsonTransformation] + public partial class EventHubDataConnection : DataConnection + { + /// + /// Initializes a new instance of the EventHubDataConnection class. + /// + public EventHubDataConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EventHubDataConnection class. + /// + /// The resource ID of the event hub + /// to be used to create a data connection. + /// The event hub consumer group. + /// 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" + /// Resource location. + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// The table where the data should be + /// ingested. Optionally the table information can be added to each + /// message. + /// The mapping rule to be used to ingest + /// the data. Optionally the mapping information can be added to each + /// message. + /// The data format of the message. Optionally + /// the data format can be added to each message. Possible values + /// include: 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', + /// 'TXT', 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE', 'PARQUET', 'ORC', + /// 'APACHEAVRO', 'W3CLOGFILE' + /// System properties of the event + /// hub + /// The event hub messages compression type. + /// Possible values include: 'None', 'GZip' + /// The provisioned state of the + /// resource. Possible values include: 'Running', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Moving', 'Canceled' + /// The resource ID of a + /// managed identity (system or user assigned) to be used to + /// authenticate with event hub. + public EventHubDataConnection(string eventHubResourceId, string consumerGroup, string id = default(string), string name = default(string), string type = default(string), string location = default(string), SystemData systemData = default(SystemData), string tableName = default(string), string mappingRuleName = default(string), string dataFormat = default(string), IList eventSystemProperties = default(IList), string compression = default(string), string provisioningState = default(string), string managedIdentityResourceId = default(string)) + : base(id, name, type, location, systemData) + { + EventHubResourceId = eventHubResourceId; + ConsumerGroup = consumerGroup; + TableName = tableName; + MappingRuleName = mappingRuleName; + DataFormat = dataFormat; + EventSystemProperties = eventSystemProperties; + Compression = compression; + ProvisioningState = provisioningState; + ManagedIdentityResourceId = managedIdentityResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource ID of the event hub to be used to create + /// a data connection. + /// + [JsonProperty(PropertyName = "properties.eventHubResourceId")] + public string EventHubResourceId { get; set; } + + /// + /// Gets or sets the event hub consumer group. + /// + [JsonProperty(PropertyName = "properties.consumerGroup")] + public string ConsumerGroup { get; set; } + + /// + /// Gets or sets the table where the data should be ingested. + /// Optionally the table information can be added to each message. + /// + [JsonProperty(PropertyName = "properties.tableName")] + public string TableName { get; set; } + + /// + /// Gets or sets the mapping rule to be used to ingest the data. + /// Optionally the mapping information can be added to each message. + /// + [JsonProperty(PropertyName = "properties.mappingRuleName")] + public string MappingRuleName { get; set; } + + /// + /// Gets or sets the data format of the message. Optionally the data + /// format can be added to each message. Possible values include: + /// 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', + /// 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE', 'PARQUET', 'ORC', + /// 'APACHEAVRO', 'W3CLOGFILE' + /// + [JsonProperty(PropertyName = "properties.dataFormat")] + public string DataFormat { get; set; } + + /// + /// Gets or sets system properties of the event hub + /// + [JsonProperty(PropertyName = "properties.eventSystemProperties")] + public IList EventSystemProperties { get; set; } + + /// + /// Gets or sets the event hub messages compression type. Possible + /// values include: 'None', 'GZip' + /// + [JsonProperty(PropertyName = "properties.compression")] + public string Compression { get; set; } + + /// + /// Gets or sets the provisioned state of the resource. Possible values + /// include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', + /// 'Moving', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets the resource ID of a managed identity (system or user + /// assigned) to be used to authenticate with event hub. + /// + [JsonProperty(PropertyName = "properties.managedIdentityResourceId")] + public string ManagedIdentityResourceId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (EventHubResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "EventHubResourceId"); + } + if (ConsumerGroup == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ConsumerGroup"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/EventHubDataFormat.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/EventHubDataFormat.cs new file mode 100644 index 000000000000..c997f4bb3965 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/EventHubDataFormat.cs @@ -0,0 +1,36 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + + /// + /// Defines values for EventHubDataFormat. + /// + public static class EventHubDataFormat + { + public const string MULTIJSON = "MULTIJSON"; + public const string JSON = "JSON"; + public const string CSV = "CSV"; + public const string TSV = "TSV"; + public const string SCSV = "SCSV"; + public const string SOHSV = "SOHSV"; + public const string PSV = "PSV"; + public const string TXT = "TXT"; + public const string RAW = "RAW"; + public const string SINGLEJSON = "SINGLEJSON"; + public const string AVRO = "AVRO"; + public const string TSVE = "TSVE"; + public const string PARQUET = "PARQUET"; + public const string ORC = "ORC"; + public const string APACHEAVRO = "APACHEAVRO"; + public const string W3CLOGFILE = "W3CLOGFILE"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/FollowerDatabaseDefinition.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/FollowerDatabaseDefinition.cs new file mode 100644 index 000000000000..43e1ebfab57f --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/FollowerDatabaseDefinition.cs @@ -0,0 +1,92 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A class representing follower database request. + /// + public partial class FollowerDatabaseDefinition + { + /// + /// Initializes a new instance of the FollowerDatabaseDefinition class. + /// + public FollowerDatabaseDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FollowerDatabaseDefinition class. + /// + /// Resource id of the cluster that + /// follows a database owned by this cluster. + /// Resource name of + /// the attached database configuration in the follower + /// cluster. + /// The database name owned by this cluster + /// that was followed. * in case following all databases. + public FollowerDatabaseDefinition(string kustoPoolResourceId, string attachedDatabaseConfigurationName, string databaseName = default(string)) + { + KustoPoolResourceId = kustoPoolResourceId; + AttachedDatabaseConfigurationName = attachedDatabaseConfigurationName; + DatabaseName = databaseName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource id of the cluster that follows a database + /// owned by this cluster. + /// + [JsonProperty(PropertyName = "clusterResourceId")] + public string KustoPoolResourceId { get; set; } + + /// + /// Gets or sets resource name of the attached database configuration + /// in the follower cluster. + /// + [JsonProperty(PropertyName = "attachedDatabaseConfigurationName")] + public string AttachedDatabaseConfigurationName { get; set; } + + /// + /// Gets the database name owned by this cluster that was followed. * + /// in case following all databases. + /// + [JsonProperty(PropertyName = "databaseName")] + public string DatabaseName { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (KustoPoolResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KustoPoolResourceId"); + } + if (AttachedDatabaseConfigurationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AttachedDatabaseConfigurationName"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/IotHubDataConnection.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/IotHubDataConnection.cs new file mode 100644 index 000000000000..097072bec45c --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/IotHubDataConnection.cs @@ -0,0 +1,166 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Class representing an iot hub data connection. + /// + [Newtonsoft.Json.JsonObject("IotHub")] + [Rest.Serialization.JsonTransformation] + public partial class IotHubDataConnection : DataConnection + { + /// + /// Initializes a new instance of the IotHubDataConnection class. + /// + public IotHubDataConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IotHubDataConnection class. + /// + /// The resource ID of the Iot hub to be + /// used to create a data connection. + /// The iot hub consumer group. + /// The name of the share access + /// policy + /// 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" + /// Resource location. + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// The table where the data should be + /// ingested. Optionally the table information can be added to each + /// message. + /// The mapping rule to be used to ingest + /// the data. Optionally the mapping information can be added to each + /// message. + /// The data format of the message. Optionally + /// the data format can be added to each message. Possible values + /// include: 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', + /// 'TXT', 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE', 'PARQUET', 'ORC', + /// 'APACHEAVRO', 'W3CLOGFILE' + /// System properties of the iot + /// hub + /// The provisioned state of the + /// resource. Possible values include: 'Running', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Moving', 'Canceled' + public IotHubDataConnection(string iotHubResourceId, string consumerGroup, string sharedAccessPolicyName, string id = default(string), string name = default(string), string type = default(string), string location = default(string), SystemData systemData = default(SystemData), string tableName = default(string), string mappingRuleName = default(string), string dataFormat = default(string), IList eventSystemProperties = default(IList), string provisioningState = default(string)) + : base(id, name, type, location, systemData) + { + IotHubResourceId = iotHubResourceId; + ConsumerGroup = consumerGroup; + TableName = tableName; + MappingRuleName = mappingRuleName; + DataFormat = dataFormat; + EventSystemProperties = eventSystemProperties; + SharedAccessPolicyName = sharedAccessPolicyName; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource ID of the Iot hub to be used to create a + /// data connection. + /// + [JsonProperty(PropertyName = "properties.iotHubResourceId")] + public string IotHubResourceId { get; set; } + + /// + /// Gets or sets the iot hub consumer group. + /// + [JsonProperty(PropertyName = "properties.consumerGroup")] + public string ConsumerGroup { get; set; } + + /// + /// Gets or sets the table where the data should be ingested. + /// Optionally the table information can be added to each message. + /// + [JsonProperty(PropertyName = "properties.tableName")] + public string TableName { get; set; } + + /// + /// Gets or sets the mapping rule to be used to ingest the data. + /// Optionally the mapping information can be added to each message. + /// + [JsonProperty(PropertyName = "properties.mappingRuleName")] + public string MappingRuleName { get; set; } + + /// + /// Gets or sets the data format of the message. Optionally the data + /// format can be added to each message. Possible values include: + /// 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', + /// 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE', 'PARQUET', 'ORC', + /// 'APACHEAVRO', 'W3CLOGFILE' + /// + [JsonProperty(PropertyName = "properties.dataFormat")] + public string DataFormat { get; set; } + + /// + /// Gets or sets system properties of the iot hub + /// + [JsonProperty(PropertyName = "properties.eventSystemProperties")] + public IList EventSystemProperties { get; set; } + + /// + /// Gets or sets the name of the share access policy + /// + [JsonProperty(PropertyName = "properties.sharedAccessPolicyName")] + public string SharedAccessPolicyName { get; set; } + + /// + /// Gets or sets the provisioned state of the resource. Possible values + /// include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', + /// 'Moving', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (IotHubResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "IotHubResourceId"); + } + if (ConsumerGroup == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ConsumerGroup"); + } + if (SharedAccessPolicyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SharedAccessPolicyName"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/IotHubDataFormat.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/IotHubDataFormat.cs new file mode 100644 index 000000000000..6ae68ca51512 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/IotHubDataFormat.cs @@ -0,0 +1,36 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + + /// + /// Defines values for IotHubDataFormat. + /// + public static class IotHubDataFormat + { + public const string MULTIJSON = "MULTIJSON"; + public const string JSON = "JSON"; + public const string CSV = "CSV"; + public const string TSV = "TSV"; + public const string SCSV = "SCSV"; + public const string SOHSV = "SOHSV"; + public const string PSV = "PSV"; + public const string TXT = "TXT"; + public const string RAW = "RAW"; + public const string SINGLEJSON = "SINGLEJSON"; + public const string AVRO = "AVRO"; + public const string TSVE = "TSVE"; + public const string PARQUET = "PARQUET"; + public const string ORC = "ORC"; + public const string APACHEAVRO = "APACHEAVRO"; + public const string W3CLOGFILE = "W3CLOGFILE"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/KustoPool.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/KustoPool.cs new file mode 100644 index 000000000000..e555d50bc895 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/KustoPool.cs @@ -0,0 +1,204 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Class representing a Kusto kusto pool. + /// + [Rest.Serialization.JsonTransformation] + public partial class KustoPool : TrackedResource + { + /// + /// Initializes a new instance of the KustoPool class. + /// + public KustoPool() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KustoPool class. + /// + /// The geo-location where the resource + /// lives + /// The SKU of the kusto pool. + /// 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" + /// Resource tags. + /// The state of the resource. Possible values + /// include: 'Creating', 'Unavailable', 'Running', 'Deleting', + /// 'Deleted', 'Stopping', 'Stopped', 'Starting', 'Updating' + /// The provisioned state of the + /// resource. Possible values include: 'Running', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Moving', 'Canceled' + /// The Kusto Pool URI. + /// The Kusto Pool data ingestion + /// URI. + /// The reason for the Kusto Pool's current + /// state. + /// Optimized auto scale + /// definition. + /// A boolean value that indicates + /// if the streaming ingest is enabled. + /// A boolean value that indicates if the + /// purge operations are enabled. + /// List of the Kusto Pool's language + /// extensions. + /// The workspace unique identifier. + /// A unique read-only string that changes whenever + /// the resource is updated. + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public KustoPool(string location, AzureSku sku, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string state = default(string), string provisioningState = default(string), string uri = default(string), string dataIngestionUri = default(string), string stateReason = default(string), OptimizedAutoscale optimizedAutoscale = default(OptimizedAutoscale), bool? enableStreamingIngest = default(bool?), bool? enablePurge = default(bool?), LanguageExtensionsList languageExtensions = default(LanguageExtensionsList), string workspaceUID = default(string), string etag = default(string), SystemData systemData = default(SystemData)) + : base(location, id, name, type, tags) + { + Sku = sku; + State = state; + ProvisioningState = provisioningState; + Uri = uri; + DataIngestionUri = dataIngestionUri; + StateReason = stateReason; + OptimizedAutoscale = optimizedAutoscale; + EnableStreamingIngest = enableStreamingIngest; + EnablePurge = enablePurge; + LanguageExtensions = languageExtensions; + WorkspaceUID = workspaceUID; + Etag = etag; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the SKU of the kusto pool. + /// + [JsonProperty(PropertyName = "sku")] + public AzureSku Sku { get; set; } + + /// + /// Gets the state of the resource. Possible values include: + /// 'Creating', 'Unavailable', 'Running', 'Deleting', 'Deleted', + /// 'Stopping', 'Stopped', 'Starting', 'Updating' + /// + [JsonProperty(PropertyName = "properties.state")] + public string State { get; private set; } + + /// + /// Gets or sets the provisioned state of the resource. Possible values + /// include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', + /// 'Moving', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets the Kusto Pool URI. + /// + [JsonProperty(PropertyName = "properties.uri")] + public string Uri { get; private set; } + + /// + /// Gets the Kusto Pool data ingestion URI. + /// + [JsonProperty(PropertyName = "properties.dataIngestionUri")] + public string DataIngestionUri { get; private set; } + + /// + /// Gets the reason for the Kusto Pool's current state. + /// + [JsonProperty(PropertyName = "properties.stateReason")] + public string StateReason { get; private set; } + + /// + /// Gets or sets optimized auto scale definition. + /// + [JsonProperty(PropertyName = "properties.optimizedAutoscale")] + public OptimizedAutoscale OptimizedAutoscale { get; set; } + + /// + /// Gets or sets a boolean value that indicates if the streaming ingest + /// is enabled. + /// + [JsonProperty(PropertyName = "properties.enableStreamingIngest")] + public bool? EnableStreamingIngest { get; set; } + + /// + /// Gets or sets a boolean value that indicates if the purge operations + /// are enabled. + /// + [JsonProperty(PropertyName = "properties.enablePurge")] + public bool? EnablePurge { get; set; } + + /// + /// Gets list of the Kusto Pool's language extensions. + /// + [JsonProperty(PropertyName = "properties.languageExtensions")] + public LanguageExtensionsList LanguageExtensions { get; private set; } + + /// + /// Gets or sets the workspace unique identifier. + /// + [JsonProperty(PropertyName = "properties.workspaceUID")] + public string WorkspaceUID { get; set; } + + /// + /// Gets a unique read-only string that changes whenever the resource + /// is updated. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + /// + /// Gets azure Resource Manager metadata containing createdBy and + /// modifiedBy information. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Sku == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Sku"); + } + if (Sku != null) + { + Sku.Validate(); + } + if (OptimizedAutoscale != null) + { + OptimizedAutoscale.Validate(); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/KustoPoolCheckNameRequest.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/KustoPoolCheckNameRequest.cs new file mode 100644 index 000000000000..8180fd5b3699 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/KustoPoolCheckNameRequest.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The object sent for a kusto pool check name availability request. + /// + public partial class KustoPoolCheckNameRequest + { + /// + /// Initializes a new instance of the KustoPoolCheckNameRequest class. + /// + public KustoPoolCheckNameRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KustoPoolCheckNameRequest class. + /// + /// Kusto Pool name. + public KustoPoolCheckNameRequest(string name) + { + Name = name; + CustomInit(); + } + /// + /// Static constructor for KustoPoolCheckNameRequest class. + /// + static KustoPoolCheckNameRequest() + { + Type = "Microsoft.Synapse/workspaces/kustoPools"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets kusto Pool name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// The type of resource, Microsoft.Synapse/workspaces/kustoPools. + /// + [JsonProperty(PropertyName = "type")] + public static string Type { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/KustoPoolListResult.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/KustoPoolListResult.cs new file mode 100644 index 000000000000..28d18177b26b --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/KustoPoolListResult.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The list Kusto pools operation response. + /// + public partial class KustoPoolListResult + { + /// + /// Initializes a new instance of the KustoPoolListResult class. + /// + public KustoPoolListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KustoPoolListResult class. + /// + /// The list of Kusto pools. + public KustoPoolListResult(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 Kusto pools. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/KustoPoolUpdate.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/KustoPoolUpdate.cs new file mode 100644 index 000000000000..c323d4c891e1 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/KustoPoolUpdate.cs @@ -0,0 +1,184 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Class representing an update to a Kusto kusto pool. + /// + [Rest.Serialization.JsonTransformation] + public partial class KustoPoolUpdate : Resource + { + /// + /// Initializes a new instance of the KustoPoolUpdate class. + /// + public KustoPoolUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KustoPoolUpdate 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" + /// Resource tags. + /// The SKU of the kusto pool. + /// The state of the resource. Possible values + /// include: 'Creating', 'Unavailable', 'Running', 'Deleting', + /// 'Deleted', 'Stopping', 'Stopped', 'Starting', 'Updating' + /// The provisioned state of the + /// resource. Possible values include: 'Running', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Moving', 'Canceled' + /// The Kusto Pool URI. + /// The Kusto Pool data ingestion + /// URI. + /// The reason for the Kusto Pool's current + /// state. + /// Optimized auto scale + /// definition. + /// A boolean value that indicates + /// if the streaming ingest is enabled. + /// A boolean value that indicates if the + /// purge operations are enabled. + /// List of the Kusto Pool's language + /// extensions. + /// The workspace unique identifier. + public KustoPoolUpdate(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), AzureSku sku = default(AzureSku), string state = default(string), string provisioningState = default(string), string uri = default(string), string dataIngestionUri = default(string), string stateReason = default(string), OptimizedAutoscale optimizedAutoscale = default(OptimizedAutoscale), bool? enableStreamingIngest = default(bool?), bool? enablePurge = default(bool?), LanguageExtensionsList languageExtensions = default(LanguageExtensionsList), string workspaceUID = default(string)) + : base(id, name, type) + { + Tags = tags; + Sku = sku; + State = state; + ProvisioningState = provisioningState; + Uri = uri; + DataIngestionUri = dataIngestionUri; + StateReason = stateReason; + OptimizedAutoscale = optimizedAutoscale; + EnableStreamingIngest = enableStreamingIngest; + EnablePurge = enablePurge; + LanguageExtensions = languageExtensions; + WorkspaceUID = workspaceUID; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the SKU of the kusto pool. + /// + [JsonProperty(PropertyName = "sku")] + public AzureSku Sku { get; set; } + + /// + /// Gets the state of the resource. Possible values include: + /// 'Creating', 'Unavailable', 'Running', 'Deleting', 'Deleted', + /// 'Stopping', 'Stopped', 'Starting', 'Updating' + /// + [JsonProperty(PropertyName = "properties.state")] + public string State { get; private set; } + + /// + /// Gets or sets the provisioned state of the resource. Possible values + /// include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', + /// 'Moving', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets the Kusto Pool URI. + /// + [JsonProperty(PropertyName = "properties.uri")] + public string Uri { get; private set; } + + /// + /// Gets the Kusto Pool data ingestion URI. + /// + [JsonProperty(PropertyName = "properties.dataIngestionUri")] + public string DataIngestionUri { get; private set; } + + /// + /// Gets the reason for the Kusto Pool's current state. + /// + [JsonProperty(PropertyName = "properties.stateReason")] + public string StateReason { get; private set; } + + /// + /// Gets or sets optimized auto scale definition. + /// + [JsonProperty(PropertyName = "properties.optimizedAutoscale")] + public OptimizedAutoscale OptimizedAutoscale { get; set; } + + /// + /// Gets or sets a boolean value that indicates if the streaming ingest + /// is enabled. + /// + [JsonProperty(PropertyName = "properties.enableStreamingIngest")] + public bool? EnableStreamingIngest { get; set; } + + /// + /// Gets or sets a boolean value that indicates if the purge operations + /// are enabled. + /// + [JsonProperty(PropertyName = "properties.enablePurge")] + public bool? EnablePurge { get; set; } + + /// + /// Gets list of the Kusto Pool's language extensions. + /// + [JsonProperty(PropertyName = "properties.languageExtensions")] + public LanguageExtensionsList LanguageExtensions { get; private set; } + + /// + /// Gets or sets the workspace unique identifier. + /// + [JsonProperty(PropertyName = "properties.workspaceUID")] + public string WorkspaceUID { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Sku != null) + { + Sku.Validate(); + } + if (OptimizedAutoscale != null) + { + OptimizedAutoscale.Validate(); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/LanguageExtension.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/LanguageExtension.cs new file mode 100644 index 000000000000..25f125bab06a --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/LanguageExtension.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The language extension object. + /// + public partial class LanguageExtension + { + /// + /// Initializes a new instance of the LanguageExtension class. + /// + public LanguageExtension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LanguageExtension class. + /// + /// The language extension name. + /// Possible values include: 'PYTHON', 'R' + public LanguageExtension(string languageExtensionName = default(string)) + { + LanguageExtensionName = languageExtensionName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the language extension name. Possible values include: + /// 'PYTHON', 'R' + /// + [JsonProperty(PropertyName = "languageExtensionName")] + public string LanguageExtensionName { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/LanguageExtensionName.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/LanguageExtensionName.cs new file mode 100644 index 000000000000..1e7811ff96a8 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/LanguageExtensionName.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + + /// + /// Defines values for LanguageExtensionName. + /// + public static class LanguageExtensionName + { + public const string PYTHON = "PYTHON"; + public const string R = "R"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/LanguageExtensionsList.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/LanguageExtensionsList.cs new file mode 100644 index 000000000000..967afb24e7ab --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/LanguageExtensionsList.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.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The list of language extension objects. + /// + public partial class LanguageExtensionsList + { + /// + /// Initializes a new instance of the LanguageExtensionsList class. + /// + public LanguageExtensionsList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LanguageExtensionsList class. + /// + /// The list of language extensions. + public LanguageExtensionsList(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 language extensions. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Operation.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Operation.cs new file mode 100644 index 000000000000..4448e621d1eb --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Operation.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A REST API operation + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + /// The operation name. + /// The object that describes the + /// operation. + /// The intended executor of the + /// operation. + /// Properties of the operation. + public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay), string origin = default(string), object properties = default(object)) + { + Name = name; + Display = display; + Origin = origin; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the operation name. + /// + /// + /// This is of the format {provider}/{resource}/{operation}. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the object that describes the operation. + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + /// + /// Gets or sets the intended executor of the operation. + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; set; } + + /// + /// Gets or sets properties of the operation. + /// + [JsonProperty(PropertyName = "properties")] + public object Properties { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationDisplay.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..82b872629867 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The object that describes the operation. + /// + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + /// Friendly name of the resource + /// provider. + /// The operation type. + /// The resource type on which the operation is + /// performed. + /// The friendly name of the + /// operation. + public OperationDisplay(string provider = default(string), string operation = default(string), string resource = default(string), string description = default(string)) + { + Provider = provider; + Operation = operation; + Resource = resource; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets friendly name of the resource provider. + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets the operation type. + /// + /// + /// For example: read, write, delete. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + /// + /// Gets or sets the resource type on which the operation is performed. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets the friendly name of the operation. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OptimizedAutoscale.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OptimizedAutoscale.cs new file mode 100644 index 000000000000..dd411d2dfda6 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/OptimizedAutoscale.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A class that contains the optimized auto scale definition. + /// + public partial class OptimizedAutoscale + { + /// + /// Initializes a new instance of the OptimizedAutoscale class. + /// + public OptimizedAutoscale() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OptimizedAutoscale class. + /// + /// The version of the template defined, for + /// instance 1. + /// A boolean value that indicate if the + /// optimized autoscale feature is enabled or not. + /// Minimum allowed instances count. + /// Maximum allowed instances count. + public OptimizedAutoscale(int version, bool isEnabled, int minimum, int maximum) + { + Version = version; + IsEnabled = isEnabled; + Minimum = minimum; + Maximum = maximum; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the version of the template defined, for instance 1. + /// + [JsonProperty(PropertyName = "version")] + public int Version { get; set; } + + /// + /// Gets or sets a boolean value that indicate if the optimized + /// autoscale feature is enabled or not. + /// + [JsonProperty(PropertyName = "isEnabled")] + public bool IsEnabled { get; set; } + + /// + /// Gets or sets minimum allowed instances count. + /// + [JsonProperty(PropertyName = "minimum")] + public int Minimum { get; set; } + + /// + /// Gets or sets maximum allowed instances count. + /// + [JsonProperty(PropertyName = "maximum")] + public int Maximum { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/PrincipalType.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/PrincipalType.cs new file mode 100644 index 000000000000..ef530db8a02a --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/PrincipalType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + + /// + /// Defines values for PrincipalType. + /// + public static class PrincipalType + { + public const string App = "App"; + public const string Group = "Group"; + public const string User = "User"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReadWriteDatabase.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReadWriteDatabase.cs new file mode 100644 index 000000000000..2007e8d78dd5 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ReadWriteDatabase.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.Synapse.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Class representing a read write database. + /// + [Newtonsoft.Json.JsonObject("ReadWrite")] + [Rest.Serialization.JsonTransformation] + public partial class ReadWriteDatabase : Database + { + /// + /// Initializes a new instance of the ReadWriteDatabase class. + /// + public ReadWriteDatabase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReadWriteDatabase 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" + /// Resource location. + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// The provisioned state of the + /// resource. Possible values include: 'Running', 'Creating', + /// 'Deleting', 'Succeeded', 'Failed', 'Moving', 'Canceled' + /// The time the data should be kept + /// before it stops being accessible to queries in TimeSpan. + /// The time the data should be kept in + /// cache for fast queries in TimeSpan. + /// The statistics of the database. + /// Indicates whether the database is + /// followed. + public ReadWriteDatabase(string id = default(string), string name = default(string), string type = default(string), string location = default(string), SystemData systemData = default(SystemData), string provisioningState = default(string), System.TimeSpan? softDeletePeriod = default(System.TimeSpan?), System.TimeSpan? hotCachePeriod = default(System.TimeSpan?), DatabaseStatistics statistics = default(DatabaseStatistics), bool? isFollowed = default(bool?)) + : base(id, name, type, location, systemData) + { + ProvisioningState = provisioningState; + SoftDeletePeriod = softDeletePeriod; + HotCachePeriod = hotCachePeriod; + Statistics = statistics; + IsFollowed = isFollowed; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the provisioned state of the resource. Possible values + /// include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', + /// 'Moving', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets the time the data should be kept before it stops being + /// accessible to queries in TimeSpan. + /// + [JsonProperty(PropertyName = "properties.softDeletePeriod")] + public System.TimeSpan? SoftDeletePeriod { get; set; } + + /// + /// Gets or sets the time the data should be kept in cache for fast + /// queries in TimeSpan. + /// + [JsonProperty(PropertyName = "properties.hotCachePeriod")] + public System.TimeSpan? HotCachePeriod { get; set; } + + /// + /// Gets or sets the statistics of the database. + /// + [JsonProperty(PropertyName = "properties.statistics")] + public DatabaseStatistics Statistics { get; set; } + + /// + /// Gets indicates whether the database is followed. + /// + [JsonProperty(PropertyName = "properties.isFollowed")] + public bool? IsFollowed { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Reason.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Reason.cs new file mode 100644 index 000000000000..c196580f7198 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Reason.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + + /// + /// Defines values for Reason. + /// + public static class Reason + { + public const string Invalid = "Invalid"; + public const string AlreadyExists = "AlreadyExists"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ResourceProvisioningState.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ResourceProvisioningState.cs new file mode 100644 index 000000000000..d24b644bf0ac --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/ResourceProvisioningState.cs @@ -0,0 +1,27 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + + /// + /// Defines values for ResourceProvisioningState. + /// + public static class ResourceProvisioningState + { + public const string Running = "Running"; + public const string Creating = "Creating"; + public const string Deleting = "Deleting"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Moving = "Moving"; + public const string Canceled = "Canceled"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SkuDescription.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SkuDescription.cs new file mode 100644 index 000000000000..1d2814bcf880 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SkuDescription.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Kusto SKU description of given resource type + /// + public partial class SkuDescription + { + /// + /// Initializes a new instance of the SkuDescription class. + /// + public SkuDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SkuDescription class. + /// + /// The resource type + /// The name of the SKU + /// The size of the SKU + /// The set of locations that the SKU is + /// available + /// Locations and zones + /// The restrictions because of which SKU + /// cannot be used + public SkuDescription(string resourceType = default(string), string name = default(string), string size = default(string), IList locations = default(IList), IList locationInfo = default(IList), IList restrictions = default(IList)) + { + ResourceType = resourceType; + Name = name; + Size = size; + Locations = locations; + LocationInfo = locationInfo; + Restrictions = restrictions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the resource type + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; private set; } + + /// + /// Gets the name of the SKU + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the size of the SKU + /// + [JsonProperty(PropertyName = "size")] + public string Size { get; private set; } + + /// + /// Gets the set of locations that the SKU is available + /// + [JsonProperty(PropertyName = "locations")] + public IList Locations { get; private set; } + + /// + /// Gets locations and zones + /// + [JsonProperty(PropertyName = "locationInfo")] + public IList LocationInfo { get; private set; } + + /// + /// Gets the restrictions because of which SKU cannot be used + /// + [JsonProperty(PropertyName = "restrictions")] + public IList Restrictions { get; private set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SkuLocationInfoItem.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SkuLocationInfoItem.cs new file mode 100644 index 000000000000..4c944b99881b --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SkuLocationInfoItem.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The locations and zones info for SKU. + /// + public partial class SkuLocationInfoItem + { + /// + /// Initializes a new instance of the SkuLocationInfoItem class. + /// + public SkuLocationInfoItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SkuLocationInfoItem class. + /// + /// The available location of the SKU. + /// The available zone of the SKU. + public SkuLocationInfoItem(string location, IList zones = default(IList)) + { + Location = location; + Zones = zones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the available location of the SKU. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets the available zone of the SKU. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SkuName.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SkuName.cs new file mode 100644 index 000000000000..fd105499372c --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SkuName.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + + /// + /// Defines values for SkuName. + /// + public static class SkuName + { + public const string Computeoptimized = "Compute optimized"; + public const string Storageoptimized = "Storage optimized"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SkuSize.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SkuSize.cs new file mode 100644 index 000000000000..f170e52c885c --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SkuSize.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + + /// + /// Defines values for SkuSize. + /// + public static class SkuSize + { + public const string Extrasmall = "Extra small"; + public const string Small = "Small"; + public const string Medium = "Medium"; + public const string Large = "Large"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlDatabase.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlDatabase.cs index 8afe1eec4ffe..8d42f8453bcb 100644 --- a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlDatabase.cs +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlDatabase.cs @@ -44,19 +44,28 @@ public SqlDatabase() /// "Microsoft.Storage/storageAccounts" /// Resource tags. /// SystemData of SqlDatabase. + /// The status of the database. Possible values + /// include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', + /// 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', + /// 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', + /// 'OfflineSecondary', 'Pausing', 'Paused', 'Resuming', 'Scaling', + /// 'OfflineChangingDwPerformanceTiers', + /// 'OnlineChangingDwPerformanceTiers', 'Disabled' /// The collation of the database. - /// Storage redundancy of the database. - /// Possible values include: 'Geo', 'GeoZone', 'Local', 'Zone' /// The Guid of the database. - /// Status of the database. - public SqlDatabase(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData), string collation = default(string), string storageRedundancy = default(string), System.Guid? databaseGuid = default(System.Guid?), string status = default(string)) + /// The storage redundancy of the + /// database. Possible values include: 'Local', 'Geo', 'Zone', + /// 'GeoZone' + /// Sql database data retention. + public SqlDatabase(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData), string status = default(string), string collation = default(string), System.Guid? databaseGuid = default(System.Guid?), string storageRedundancy = default(string), SqlDatabaseDataRetention dataRetention = default(SqlDatabaseDataRetention)) : base(location, id, name, type, tags) { SystemData = systemData; + Status = status; Collation = collation; - StorageRedundancy = storageRedundancy; DatabaseGuid = databaseGuid; - Status = status; + StorageRedundancy = storageRedundancy; + DataRetention = dataRetention; CustomInit(); } @@ -72,17 +81,22 @@ public SqlDatabase() public SystemData SystemData { get; private set; } /// - /// Gets or sets the collation of the database. + /// Gets the status of the database. Possible values include: 'Online', + /// 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', + /// 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', + /// 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', + /// 'Paused', 'Resuming', 'Scaling', + /// 'OfflineChangingDwPerformanceTiers', + /// 'OnlineChangingDwPerformanceTiers', 'Disabled' /// - [JsonProperty(PropertyName = "properties.collation")] - public string Collation { get; set; } + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } /// - /// Gets or sets storage redundancy of the database. Possible values - /// include: 'Geo', 'GeoZone', 'Local', 'Zone' + /// Gets or sets the collation of the database. /// - [JsonProperty(PropertyName = "properties.storageRedundancy")] - public string StorageRedundancy { get; set; } + [JsonProperty(PropertyName = "properties.collation")] + public string Collation { get; set; } /// /// Gets the Guid of the database. @@ -91,10 +105,17 @@ public SqlDatabase() public System.Guid? DatabaseGuid { get; private set; } /// - /// Gets status of the database. + /// Gets or sets the storage redundancy of the database. Possible + /// values include: 'Local', 'Geo', 'Zone', 'GeoZone' /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; private set; } + [JsonProperty(PropertyName = "properties.storageRedundancy")] + public string StorageRedundancy { get; set; } + + /// + /// Gets or sets sql database data retention. + /// + [JsonProperty(PropertyName = "properties.dataRetention")] + public SqlDatabaseDataRetention DataRetention { get; set; } /// /// Validate the object. diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlDatabaseDataRetention.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlDatabaseDataRetention.cs new file mode 100644 index 000000000000..b7cb6bf3f4c2 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlDatabaseDataRetention.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Sql database data retention. + /// + public partial class SqlDatabaseDataRetention + { + /// + /// Initializes a new instance of the SqlDatabaseDataRetention class. + /// + public SqlDatabaseDataRetention() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlDatabaseDataRetention class. + /// + /// Specifies the data retention period + /// (ISO8601 format). + /// Specifies the dropped database + /// retention period (ISO8601 format). + public SqlDatabaseDataRetention(System.TimeSpan? retentionPeriod = default(System.TimeSpan?), System.TimeSpan? dropRetentionPeriod = default(System.TimeSpan?)) + { + RetentionPeriod = retentionPeriod; + DropRetentionPeriod = dropRetentionPeriod; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the data retention period (ISO8601 format). + /// + [JsonProperty(PropertyName = "retentionPeriod")] + public System.TimeSpan? RetentionPeriod { get; set; } + + /// + /// Gets or sets specifies the dropped database retention period + /// (ISO8601 format). + /// + [JsonProperty(PropertyName = "dropRetentionPeriod")] + public System.TimeSpan? DropRetentionPeriod { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlDatabaseUpdate.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlDatabaseUpdate.cs index 625b2eb1c45c..65d667cf1f39 100644 --- a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlDatabaseUpdate.cs +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlDatabaseUpdate.cs @@ -34,18 +34,27 @@ public SqlDatabaseUpdate() /// /// Initializes a new instance of the SqlDatabaseUpdate class. /// + /// The status of the database. Possible values + /// include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', + /// 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', + /// 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', + /// 'OfflineSecondary', 'Pausing', 'Paused', 'Resuming', 'Scaling', + /// 'OfflineChangingDwPerformanceTiers', + /// 'OnlineChangingDwPerformanceTiers', 'Disabled' /// The collation of the database. - /// Storage redundancy of the database. - /// Possible values include: 'Geo', 'GeoZone', 'Local', 'Zone' /// The Guid of the database. - /// Status of the database. + /// The storage redundancy of the + /// database. Possible values include: 'Local', 'Geo', 'Zone', + /// 'GeoZone' + /// Sql database data retention. /// Resource tags. - public SqlDatabaseUpdate(string collation = default(string), string storageRedundancy = default(string), System.Guid? databaseGuid = default(System.Guid?), string status = default(string), IDictionary tags = default(IDictionary)) + public SqlDatabaseUpdate(string status = default(string), string collation = default(string), System.Guid? databaseGuid = default(System.Guid?), string storageRedundancy = default(string), SqlDatabaseDataRetention dataRetention = default(SqlDatabaseDataRetention), IDictionary tags = default(IDictionary)) { + Status = status; Collation = collation; - StorageRedundancy = storageRedundancy; DatabaseGuid = databaseGuid; - Status = status; + StorageRedundancy = storageRedundancy; + DataRetention = dataRetention; Tags = tags; CustomInit(); } @@ -56,17 +65,22 @@ public SqlDatabaseUpdate() partial void CustomInit(); /// - /// Gets or sets the collation of the database. + /// Gets the status of the database. Possible values include: 'Online', + /// 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', + /// 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', + /// 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', + /// 'Paused', 'Resuming', 'Scaling', + /// 'OfflineChangingDwPerformanceTiers', + /// 'OnlineChangingDwPerformanceTiers', 'Disabled' /// - [JsonProperty(PropertyName = "properties.collation")] - public string Collation { get; set; } + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } /// - /// Gets or sets storage redundancy of the database. Possible values - /// include: 'Geo', 'GeoZone', 'Local', 'Zone' + /// Gets or sets the collation of the database. /// - [JsonProperty(PropertyName = "properties.storageRedundancy")] - public string StorageRedundancy { get; set; } + [JsonProperty(PropertyName = "properties.collation")] + public string Collation { get; set; } /// /// Gets the Guid of the database. @@ -75,10 +89,17 @@ public SqlDatabaseUpdate() public System.Guid? DatabaseGuid { get; private set; } /// - /// Gets status of the database. + /// Gets or sets the storage redundancy of the database. Possible + /// values include: 'Local', 'Geo', 'Zone', 'GeoZone' /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; private set; } + [JsonProperty(PropertyName = "properties.storageRedundancy")] + public string StorageRedundancy { get; set; } + + /// + /// Gets or sets sql database data retention. + /// + [JsonProperty(PropertyName = "properties.dataRetention")] + public SqlDatabaseDataRetention DataRetention { get; set; } /// /// Gets or sets resource tags. diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPool.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPool.cs index 6d0545cd1f99..271494667a1e 100644 --- a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPool.cs +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPool.cs @@ -56,7 +56,24 @@ public SqlPool() /// Resource state /// Resource status /// Snapshot time to restore - /// What is this? + /// Specifies the mode of sql pool creation. + /// + /// Default: regular sql pool creation. + /// + /// PointInTimeRestore: Creates a sql pool by restoring a point in time + /// backup of an existing sql pool. sourceDatabaseId must be specified + /// as the resource ID of the existing sql pool, and restorePointInTime + /// must be specified. + /// + /// Recovery: Creates a sql pool by a geo-replicated backup. + /// sourceDatabaseId must be specified as the recoverableDatabaseId to + /// restore. + /// + /// Restore: Creates a sql pool by restoring a backup of a deleted sql + /// pool. SourceDatabaseId should be the sql pool's original resource + /// ID. SourceDatabaseId and sourceDatabaseDeletionDate must be + /// specified. Possible values include: 'Default', + /// 'PointInTimeRestore', 'Recovery', 'Restore' /// Date the SQL pool was created /// The storage account type used to /// store backups for this sql pool. Possible values include: 'GRS', @@ -135,7 +152,24 @@ public SqlPool() public System.DateTime? RestorePointInTime { get; set; } /// - /// Gets or sets what is this? + /// Gets or sets specifies the mode of sql pool creation. + /// + /// Default: regular sql pool creation. + /// + /// PointInTimeRestore: Creates a sql pool by restoring a point in time + /// backup of an existing sql pool. sourceDatabaseId must be specified + /// as the resource ID of the existing sql pool, and restorePointInTime + /// must be specified. + /// + /// Recovery: Creates a sql pool by a geo-replicated backup. + /// sourceDatabaseId must be specified as the recoverableDatabaseId to + /// restore. + /// + /// Restore: Creates a sql pool by restoring a backup of a deleted sql + /// pool. SourceDatabaseId should be the sql pool's original resource + /// ID. SourceDatabaseId and sourceDatabaseDeletionDate must be + /// specified. Possible values include: 'Default', + /// 'PointInTimeRestore', 'Recovery', 'Restore' /// [JsonProperty(PropertyName = "properties.createMode")] public string CreateMode { get; set; } diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolPatchInfo.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolPatchInfo.cs index 5dae33320f98..c09cf8a8d5f5 100644 --- a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolPatchInfo.cs +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlPoolPatchInfo.cs @@ -50,7 +50,24 @@ public SqlPoolPatchInfo() /// Resource state /// Resource status /// Snapshot time to restore - /// What is this? + /// Specifies the mode of sql pool creation. + /// + /// Default: regular sql pool creation. + /// + /// PointInTimeRestore: Creates a sql pool by restoring a point in time + /// backup of an existing sql pool. sourceDatabaseId must be specified + /// as the resource ID of the existing sql pool, and restorePointInTime + /// must be specified. + /// + /// Recovery: Creates a sql pool by a geo-replicated backup. + /// sourceDatabaseId must be specified as the recoverableDatabaseId to + /// restore. + /// + /// Restore: Creates a sql pool by restoring a backup of a deleted sql + /// pool. SourceDatabaseId should be the sql pool's original resource + /// ID. SourceDatabaseId and sourceDatabaseDeletionDate must be + /// specified. Possible values include: 'Default', + /// 'PointInTimeRestore', 'Recovery', 'Restore' /// Date the SQL pool was created /// The storage account type used to /// store backups for this sql pool. Possible values include: 'GRS', @@ -142,7 +159,24 @@ public SqlPoolPatchInfo() public System.DateTime? RestorePointInTime { get; set; } /// - /// Gets or sets what is this? + /// Gets or sets specifies the mode of sql pool creation. + /// + /// Default: regular sql pool creation. + /// + /// PointInTimeRestore: Creates a sql pool by restoring a point in time + /// backup of an existing sql pool. sourceDatabaseId must be specified + /// as the resource ID of the existing sql pool, and restorePointInTime + /// must be specified. + /// + /// Recovery: Creates a sql pool by a geo-replicated backup. + /// sourceDatabaseId must be specified as the recoverableDatabaseId to + /// restore. + /// + /// Restore: Creates a sql pool by restoring a backup of a deleted sql + /// pool. SourceDatabaseId should be the sql pool's original resource + /// ID. SourceDatabaseId and sourceDatabaseDeletionDate must be + /// specified. Possible values include: 'Default', + /// 'PointInTimeRestore', 'Recovery', 'Restore' /// [JsonProperty(PropertyName = "properties.createMode")] public string CreateMode { get; set; } diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/State.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/State.cs new file mode 100644 index 000000000000..6cc036101362 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/State.cs @@ -0,0 +1,29 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + + /// + /// Defines values for State. + /// + public static class State + { + public const string Creating = "Creating"; + public const string Unavailable = "Unavailable"; + public const string Running = "Running"; + public const string Deleting = "Deleting"; + public const string Deleted = "Deleted"; + public const string Stopping = "Stopping"; + public const string Stopped = "Stopped"; + public const string Starting = "Starting"; + public const string Updating = "Updating"; + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlDatabaseStorageRedundancyType.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/StorageRedundancy.cs similarity index 84% rename from sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlDatabaseStorageRedundancyType.cs rename to sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/StorageRedundancy.cs index d62425e7243f..ebd4a4dbf1d1 100644 --- a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/SqlDatabaseStorageRedundancyType.cs +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/StorageRedundancy.cs @@ -12,13 +12,13 @@ namespace Microsoft.Azure.Management.Synapse.Models { /// - /// Defines values for SqlDatabaseStorageRedundancyType. + /// Defines values for StorageRedundancy. /// - public static class SqlDatabaseStorageRedundancyType + public static class StorageRedundancy { - public const string Geo = "Geo"; - public const string GeoZone = "GeoZone"; public const string Local = "Local"; + public const string Geo = "Geo"; public const string Zone = "Zone"; + public const string GeoZone = "GeoZone"; } } diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/TableLevelSharingProperties.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/TableLevelSharingProperties.cs new file mode 100644 index 000000000000..397d4e335695 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/TableLevelSharingProperties.cs @@ -0,0 +1,105 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Tables that will be included and excluded in the follower database + /// + public partial class TableLevelSharingProperties + { + /// + /// Initializes a new instance of the TableLevelSharingProperties + /// class. + /// + public TableLevelSharingProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TableLevelSharingProperties + /// class. + /// + /// List of tables to include in the + /// follower database + /// List of tables to exclude from the + /// follower database + /// List of external tables to + /// include in the follower database + /// List of external tables + /// exclude from the follower database + /// List of materialized views + /// to include in the follower database + /// List of materialized views + /// exclude from the follower database + public TableLevelSharingProperties(IList tablesToInclude = default(IList), IList tablesToExclude = default(IList), IList externalTablesToInclude = default(IList), IList externalTablesToExclude = default(IList), IList materializedViewsToInclude = default(IList), IList materializedViewsToExclude = default(IList)) + { + TablesToInclude = tablesToInclude; + TablesToExclude = tablesToExclude; + ExternalTablesToInclude = externalTablesToInclude; + ExternalTablesToExclude = externalTablesToExclude; + MaterializedViewsToInclude = materializedViewsToInclude; + MaterializedViewsToExclude = materializedViewsToExclude; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of tables to include in the follower database + /// + [JsonProperty(PropertyName = "tablesToInclude")] + public IList TablesToInclude { get; set; } + + /// + /// Gets or sets list of tables to exclude from the follower database + /// + [JsonProperty(PropertyName = "tablesToExclude")] + public IList TablesToExclude { get; set; } + + /// + /// Gets or sets list of external tables to include in the follower + /// database + /// + [JsonProperty(PropertyName = "externalTablesToInclude")] + public IList ExternalTablesToInclude { get; set; } + + /// + /// Gets or sets list of external tables exclude from the follower + /// database + /// + [JsonProperty(PropertyName = "externalTablesToExclude")] + public IList ExternalTablesToExclude { get; set; } + + /// + /// Gets or sets list of materialized views to include in the follower + /// database + /// + [JsonProperty(PropertyName = "materializedViewsToInclude")] + public IList MaterializedViewsToInclude { get; set; } + + /// + /// Gets or sets list of materialized views exclude from the follower + /// database + /// + [JsonProperty(PropertyName = "materializedViewsToExclude")] + public IList MaterializedViewsToExclude { get; set; } + + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Type.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Type.cs new file mode 100644 index 000000000000..25965d39fc47 --- /dev/null +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/Models/Type.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Synapse.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for Type. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum Type + { + [EnumMember(Value = "Microsoft.Synapse/workspaces/kustoPools/databases")] + MicrosoftSynapseWorkspacesKustoPoolsDatabases, + [EnumMember(Value = "Microsoft.Synapse/workspaces/kustoPools/attachedDatabaseConfigurations")] + MicrosoftSynapseWorkspacesKustoPoolsAttachedDatabaseConfigurations + } + internal static class TypeEnumExtension + { + internal static string ToSerializedValue(this Type? value) + { + return value == null ? null : ((Type)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this Type value) + { + switch( value ) + { + case Type.MicrosoftSynapseWorkspacesKustoPoolsDatabases: + return "Microsoft.Synapse/workspaces/kustoPools/databases"; + case Type.MicrosoftSynapseWorkspacesKustoPoolsAttachedDatabaseConfigurations: + return "Microsoft.Synapse/workspaces/kustoPools/attachedDatabaseConfigurations"; + } + return null; + } + + internal static Type? ParseType(this string value) + { + switch( value ) + { + case "Microsoft.Synapse/workspaces/kustoPools/databases": + return Type.MicrosoftSynapseWorkspacesKustoPoolsDatabases; + case "Microsoft.Synapse/workspaces/kustoPools/attachedDatabaseConfigurations": + return Type.MicrosoftSynapseWorkspacesKustoPoolsAttachedDatabaseConfigurations; + } + return null; + } + } +} diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SdkInfo_SynapseManagementClient.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SdkInfo_SynapseManagementClient.cs index 5198a0598846..bcdafe677d26 100644 --- a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SdkInfo_SynapseManagementClient.cs +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SdkInfo_SynapseManagementClient.cs @@ -14,7 +14,7 @@ namespace Microsoft.Azure.Management.Synapse internal static partial class SdkInfo { public static IEnumerable> ApiInfo_SynapseManagementClient - { + { get { return new Tuple[] @@ -35,6 +35,15 @@ public static IEnumerable> ApiInfo_SynapseManageme new Tuple("Synapse", "IntegrationRuntimes", "2021-06-01-preview"), new Tuple("Synapse", "IpFirewallRules", "2021-06-01"), new Tuple("Synapse", "Keys", "2021-06-01"), + new Tuple("Synapse", "KustoOperations", "2021-06-01-preview"), + new Tuple("Synapse", "KustoPool", "2021-06-01-preview"), + new Tuple("Synapse", "KustoPoolAttachedDatabaseConfigurations", "2021-06-01-preview"), + new Tuple("Synapse", "KustoPoolChildResource", "2021-06-01-preview"), + new Tuple("Synapse", "KustoPoolDataConnections", "2021-06-01-preview"), + new Tuple("Synapse", "KustoPoolDatabasePrincipalAssignments", "2021-06-01-preview"), + new Tuple("Synapse", "KustoPoolDatabases", "2021-06-01-preview"), + new Tuple("Synapse", "KustoPoolPrincipalAssignments", "2021-06-01-preview"), + new Tuple("Synapse", "KustoPools", "2021-06-01-preview"), new Tuple("Synapse", "Libraries", "2021-06-01-preview"), new Tuple("Synapse", "Library", "2021-06-01-preview"), new Tuple("Synapse", "Operations", "2021-06-01"), @@ -83,19 +92,9 @@ public static IEnumerable> ApiInfo_SynapseManageme new Tuple("Synapse", "WorkspaceManagedSqlServerVulnerabilityAssessments", "2021-06-01"), new Tuple("Synapse", "WorkspaceSqlAadAdmins", "2021-06-01"), new Tuple("Synapse", "Workspaces", "2021-06-01"), + new Tuple("Synapse", "kustoPools", "2021-06-01-preview"), }.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/main/specification/synapse/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\ZeshiLuo\\azure-sdk-for-net-1\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "main"; - public static readonly String GithubCommidId = "5d09c12c024fa7efbaca6a95b9741a46a886fe6f"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SdkInfo_SynapseSqlVManagementClient.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SdkInfo_SynapseSqlVManagementClient.cs index 55467ab958c7..0ca731a1cbdb 100644 --- a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SdkInfo_SynapseSqlVManagementClient.cs +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SdkInfo_SynapseSqlVManagementClient.cs @@ -27,4 +27,3 @@ public static IEnumerable> ApiInfo_SynapseSqlVMana } } } - diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SynapseManagementClient.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SynapseManagementClient.cs index d9ffe0e369f4..9947875d10c9 100644 --- a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SynapseManagementClient.cs +++ b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/SynapseManagementClient.cs @@ -389,6 +389,51 @@ public partial class SynapseManagementClient : ServiceClient public virtual ISparkConfigurationsOperations SparkConfigurations { get; private set; } + /// + /// Gets the IKustoOperations. + /// + public virtual IKustoOperations KustoOperations { get; private set; } + + /// + /// Gets the IKustoPoolOperations. + /// + public virtual IKustoPoolOperations KustoPool { get; private set; } + + /// + /// Gets the IKustoPoolsOperations. + /// + public virtual IKustoPoolsOperations KustoPools { get; private set; } + + /// + /// Gets the IKustoPoolChildResourceOperations. + /// + public virtual IKustoPoolChildResourceOperations KustoPoolChildResource { get; private set; } + + /// + /// Gets the IKustoPoolAttachedDatabaseConfigurationsOperations. + /// + public virtual IKustoPoolAttachedDatabaseConfigurationsOperations KustoPoolAttachedDatabaseConfigurations { get; private set; } + + /// + /// Gets the IKustoPoolDatabasesOperations. + /// + public virtual IKustoPoolDatabasesOperations KustoPoolDatabases { get; private set; } + + /// + /// Gets the IKustoPoolDataConnectionsOperations. + /// + public virtual IKustoPoolDataConnectionsOperations KustoPoolDataConnections { get; private set; } + + /// + /// Gets the IKustoPoolPrincipalAssignmentsOperations. + /// + public virtual IKustoPoolPrincipalAssignmentsOperations KustoPoolPrincipalAssignments { get; private set; } + + /// + /// Gets the IKustoPoolDatabasePrincipalAssignmentsOperations. + /// + public virtual IKustoPoolDatabasePrincipalAssignmentsOperations KustoPoolDatabasePrincipalAssignments { get; private set; } + /// /// Initializes a new instance of the SynapseManagementClient class. /// @@ -694,6 +739,15 @@ private void Initialize() IntegrationRuntimeStatus = new IntegrationRuntimeStatusOperations(this); SparkConfiguration = new SparkConfigurationOperations(this); SparkConfigurations = new SparkConfigurationsOperations(this); + KustoOperations = new KustoOperations(this); + KustoPool = new KustoPoolOperations(this); + KustoPools = new KustoPoolsOperations(this); + KustoPoolChildResource = new KustoPoolChildResourceOperations(this); + KustoPoolAttachedDatabaseConfigurations = new KustoPoolAttachedDatabaseConfigurationsOperations(this); + KustoPoolDatabases = new KustoPoolDatabasesOperations(this); + KustoPoolDataConnections = new KustoPoolDataConnectionsOperations(this); + KustoPoolPrincipalAssignments = new KustoPoolPrincipalAssignmentsOperations(this); + KustoPoolDatabasePrincipalAssignments = new KustoPoolDatabasePrincipalAssignmentsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; @@ -736,6 +790,10 @@ private void Initialize() DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("type")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); CustomInitialize(); DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceManagedSqlServerRecoverableSqlpoolsOperations.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceManagedSqlServerRecoverableSqlPoolsOperations.cs similarity index 100% rename from sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceManagedSqlServerRecoverableSqlpoolsOperations.cs rename to sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceManagedSqlServerRecoverableSqlPoolsOperations.cs diff --git a/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceManagedSqlServerRecoverableSqlpoolsOperationsExtensions.cs b/sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceManagedSqlServerRecoverableSqlPoolsOperationsExtensions.cs similarity index 100% rename from sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceManagedSqlServerRecoverableSqlpoolsOperationsExtensions.cs rename to sdk/synapse/Microsoft.Azure.Management.Synapse/src/Generated/WorkspaceManagedSqlServerRecoverableSqlPoolsOperationsExtensions.cs