/// <summary>
 /// Creates or updates a server's DevOps audit settings.
 /// </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='devOpsAuditingSettingsName'>
 /// The name of the devops audit settings. This should always be 'default'.
 /// </param>
 /// <param name='parameters'>
 /// Properties of DevOps audit settings
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ServerDevOpsAuditingSettings> BeginCreateOrUpdateAsync(this IServerDevOpsAuditSettingsOperations operations, string resourceGroupName, string serverName, string devOpsAuditingSettingsName, ServerDevOpsAuditingSettings parameters, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Exemple #2
0
        public bool SetDevOpsAuditingPolicy(string resourceGroupName, string serverName,
                                            ServerDevOpsAuditingSettings policy)
        {
            return(SetAuditingPolicyInternal(() =>
            {
                SqlManagementClient client = GetCurrentSqlClient();
                IServerDevOpsAuditSettingsOperations serverDevOpsAuditSettings = client.ServerDevOpsAuditSettings;

                AzureOperationResponse <ServerDevOpsAuditingSettings> response =
                    serverDevOpsAuditSettings.BeginCreateOrUpdateWithHttpMessagesAsync(
                        resourceGroupName, serverName, "default", policy).Result;
                return client.GetLongRunningOperationResultAsync(response, null, CancellationToken.None).Result.Response.IsSuccessStatusCode;
            }));
        }