public async Task <Response <ServerAutomaticTuning> > GetAsync(string resourceGroupName, string serverName, CancellationToken cancellationToken = default)
        {
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (serverName == null)
            {
                throw new ArgumentNullException(nameof(serverName));
            }

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

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

                value = ServerAutomaticTuning.DeserializeServerAutomaticTuning(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
示例#2
0
 public virtual async Task <Response <ServerAutomaticTuning> > UpdateAsync(string resourceGroupName, string serverName, ServerAutomaticTuning parameters, CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("ServerAutomaticTuningOperations.Update");
     scope.Start();
     try
     {
         return(await RestClient.UpdateAsync(resourceGroupName, serverName, parameters, cancellationToken).ConfigureAwait(false));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }