예제 #1
0
        public async Task <Response <DatabaseBlobAuditingPolicy> > GetAsync(string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default)
        {
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (serverName == null)
            {
                throw new ArgumentNullException(nameof(serverName));
            }
            if (databaseName == null)
            {
                throw new ArgumentNullException(nameof(databaseName));
            }

            using var message = CreateGetRequest(resourceGroupName, serverName, databaseName);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            {
                DatabaseBlobAuditingPolicy value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                value = DatabaseBlobAuditingPolicy.DeserializeDatabaseBlobAuditingPolicy(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
예제 #2
0
 public virtual async Task <Response <DatabaseBlobAuditingPolicy> > CreateOrUpdateAsync(string resourceGroupName, string serverName, string databaseName, DatabaseBlobAuditingPolicy parameters, CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("DatabaseBlobAuditingPoliciesOperations.CreateOrUpdate");
     scope.Start();
     try
     {
         return(await RestClient.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, cancellationToken).ConfigureAwait(false));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }