Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add data masking client, test, recording #3391

Merged
merged 5 commits into from
Jun 23, 2017
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
903 changes: 900 additions & 3 deletions src/SDKs/SqlManagement/Management.Sql/Generated/DatabasesOperations.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,216 @@ public static IEnumerable<RestorePoint> ListRestorePoints(this IDatabasesOperati
}
}

/// <summary>
/// Creates or updates a database data masking policy
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='resourceGroupName'>
/// The name of the resource group that contains the resource. You can obtain
/// this value from the Azure Resource Manager API or the portal.
/// </param>
/// <param name='serverName'>
/// The name of the server.
/// </param>
/// <param name='databaseName'>
/// The name of the database.
/// </param>
/// <param name='parameters'>
/// Parameters for creating or updating a data masking policy.
/// </param>
public static DataMaskingPolicy CreateOrUpdateDataMaskingPolicy(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, DataMaskingPolicy parameters)
{
return operations.CreateOrUpdateDataMaskingPolicyAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult();
}

/// <summary>
/// Creates or updates a database data masking policy
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='resourceGroupName'>
/// The name of the resource group that contains the resource. You can obtain
/// this value from the Azure Resource Manager API or the portal.
/// </param>
/// <param name='serverName'>
/// The name of the server.
/// </param>
/// <param name='databaseName'>
/// The name of the database.
/// </param>
/// <param name='parameters'>
/// Parameters for creating or updating a data masking policy.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<DataMaskingPolicy> CreateOrUpdateDataMaskingPolicyAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, DataMaskingPolicy parameters, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.CreateOrUpdateDataMaskingPolicyWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}

/// <summary>
/// Gets a database data masking policy.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='resourceGroupName'>
/// The name of the resource group that contains the resource. You can obtain
/// this value from the Azure Resource Manager API or the portal.
/// </param>
/// <param name='serverName'>
/// The name of the server.
/// </param>
/// <param name='databaseName'>
/// The name of the database.
/// </param>
public static DataMaskingPolicy GetDataMaskingPolicy(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
{
return operations.GetDataMaskingPolicyAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
}

/// <summary>
/// Gets a database data masking policy.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='resourceGroupName'>
/// The name of the resource group that contains the resource. You can obtain
/// this value from the Azure Resource Manager API or the portal.
/// </param>
/// <param name='serverName'>
/// The name of the server.
/// </param>
/// <param name='databaseName'>
/// The name of the database.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<DataMaskingPolicy> GetDataMaskingPolicyAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetDataMaskingPolicyWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}

/// <summary>
/// Creates or updates a database data masking rule.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='resourceGroupName'>
/// The name of the resource group that contains the resource. You can obtain
/// this value from the Azure Resource Manager API or the portal.
/// </param>
/// <param name='serverName'>
/// The name of the server.
/// </param>
/// <param name='databaseName'>
/// The name of the database.
/// </param>
/// <param name='dataMaskingRuleName'>
/// The name of the data masking rule.
/// </param>
/// <param name='parameters'>
/// The required parameters for creating or updating a data masking rule.
/// </param>
public static DataMaskingRule CreateOrUpdateDataMaskingRule(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string dataMaskingRuleName, DataMaskingRule parameters)
{
return operations.CreateOrUpdateDataMaskingRuleAsync(resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters).GetAwaiter().GetResult();
}

/// <summary>
/// Creates or updates a database data masking rule.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='resourceGroupName'>
/// The name of the resource group that contains the resource. You can obtain
/// this value from the Azure Resource Manager API or the portal.
/// </param>
/// <param name='serverName'>
/// The name of the server.
/// </param>
/// <param name='databaseName'>
/// The name of the database.
/// </param>
/// <param name='dataMaskingRuleName'>
/// The name of the data masking rule.
/// </param>
/// <param name='parameters'>
/// The required parameters for creating or updating a data masking rule.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<DataMaskingRule> CreateOrUpdateDataMaskingRuleAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string dataMaskingRuleName, DataMaskingRule parameters, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.CreateOrUpdateDataMaskingRuleWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}

/// <summary>
/// Gets a list of database data masking rules.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='resourceGroupName'>
/// The name of the resource group that contains the resource. You can obtain
/// this value from the Azure Resource Manager API or the portal.
/// </param>
/// <param name='serverName'>
/// The name of the server.
/// </param>
/// <param name='databaseName'>
/// The name of the database.
/// </param>
public static IEnumerable<DataMaskingRule> ListDataMaskingRules(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
{
return operations.ListDataMaskingRulesAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
}

/// <summary>
/// Gets a list of database data masking rules.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='resourceGroupName'>
/// The name of the resource group that contains the resource. You can obtain
/// this value from the Azure Resource Manager API or the portal.
/// </param>
/// <param name='serverName'>
/// The name of the server.
/// </param>
/// <param name='databaseName'>
/// The name of the database.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<IEnumerable<DataMaskingRule>> ListDataMaskingRulesAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListDataMaskingRulesWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}

/// <summary>
/// Updates a database geo backup policy.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,136 @@ public partial interface IDatabasesOperations
/// </exception>
Task<AzureOperationResponse<IEnumerable<RestorePoint>>> ListRestorePointsWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Creates or updates a database data masking policy
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the resource group that contains the resource. You can
/// obtain this value from the Azure Resource Manager API or the
/// portal.
/// </param>
/// <param name='serverName'>
/// The name of the server.
/// </param>
/// <param name='databaseName'>
/// The name of the database.
/// </param>
/// <param name='parameters'>
/// Parameters for creating or updating a data masking policy.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="Microsoft.Rest.Azure.CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<DataMaskingPolicy>> CreateOrUpdateDataMaskingPolicyWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DataMaskingPolicy parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Gets a database data masking policy.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the resource group that contains the resource. You can
/// obtain this value from the Azure Resource Manager API or the
/// portal.
/// </param>
/// <param name='serverName'>
/// The name of the server.
/// </param>
/// <param name='databaseName'>
/// The name of the database.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="Microsoft.Rest.Azure.CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<DataMaskingPolicy>> GetDataMaskingPolicyWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Creates or updates a database data masking rule.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the resource group that contains the resource. You can
/// obtain this value from the Azure Resource Manager API or the
/// portal.
/// </param>
/// <param name='serverName'>
/// The name of the server.
/// </param>
/// <param name='databaseName'>
/// The name of the database.
/// </param>
/// <param name='dataMaskingRuleName'>
/// The name of the data masking rule.
/// </param>
/// <param name='parameters'>
/// The required parameters for creating or updating a data masking
/// rule.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="Microsoft.Rest.Azure.CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<DataMaskingRule>> CreateOrUpdateDataMaskingRuleWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string dataMaskingRuleName, DataMaskingRule parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Gets a list of database data masking rules.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the resource group that contains the resource. You can
/// obtain this value from the Azure Resource Manager API or the
/// portal.
/// </param>
/// <param name='serverName'>
/// The name of the server.
/// </param>
/// <param name='databaseName'>
/// The name of the database.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="Microsoft.Rest.Azure.CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<IEnumerable<DataMaskingRule>>> ListDataMaskingRulesWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Updates a database geo backup policy.
/// </summary>
/// <param name='resourceGroupName'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,32 @@ public enum AuthenticationType
[EnumMember(Value = "ADPassword")]
ADPassword
}
internal static class AuthenticationTypeEnumExtension
{
internal static string ToSerializedValue(this AuthenticationType? value ) =>
value == null ? null : (( AuthenticationType )value).ToSerializedValue();

internal static string ToSerializedValue(this AuthenticationType value )
{
switch( value )
{
case AuthenticationType.SQL:
return "SQL";
case AuthenticationType.ADPassword:
return "ADPassword";
}
return null;
}

internal static AuthenticationType? ParseAuthenticationType( this string value )
{
switch( value )
{
case "SQL":
return AuthenticationType.SQL;
case "ADPassword":
return AuthenticationType.ADPassword; }
return null;
}
}
}
Loading