/* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ import { DatabaseAutomaticTuningOperations } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { SqlManagementClient } from "../sqlManagementClient"; import { DatabaseAutomaticTuningGetOptionalParams, DatabaseAutomaticTuningGetResponse, DatabaseAutomaticTuning, DatabaseAutomaticTuningUpdateOptionalParams, DatabaseAutomaticTuningUpdateResponse } from "../models"; /** Class containing DatabaseAutomaticTuningOperations operations. */ export class DatabaseAutomaticTuningOperationsImpl implements DatabaseAutomaticTuningOperations { private readonly client: SqlManagementClient; /** * Initialize a new instance of the class DatabaseAutomaticTuningOperations class. * @param client Reference to the service client */ constructor(client: SqlManagementClient) { this.client = client; } /** * Gets a database's automatic tuning. * @param 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 serverName The name of the server. * @param databaseName The name of the database. * @param options The options parameters. */ get( resourceGroupName: string, serverName: string, databaseName: string, options?: DatabaseAutomaticTuningGetOptionalParams ): Promise { return this.client.sendOperationRequest( { resourceGroupName, serverName, databaseName, options }, getOperationSpec ); } /** * Update automatic tuning properties for target database. * @param 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 serverName The name of the server. * @param databaseName The name of the database. * @param parameters The requested automatic tuning resource state. * @param options The options parameters. */ update( resourceGroupName: string, serverName: string, databaseName: string, parameters: DatabaseAutomaticTuning, options?: DatabaseAutomaticTuningUpdateOptionalParams ): Promise { return this.client.sendOperationRequest( { resourceGroupName, serverName, databaseName, parameters, options }, updateOperationSpec ); } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const getOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/automaticTuning/current", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.DatabaseAutomaticTuning }, default: {} }, queryParameters: [Parameters.apiVersion3], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.serverName, Parameters.databaseName ], headerParameters: [Parameters.accept], serializer }; const updateOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/automaticTuning/current", httpMethod: "PATCH", responses: { 200: { bodyMapper: Mappers.DatabaseAutomaticTuning }, default: {} }, requestBody: Parameters.parameters12, queryParameters: [Parameters.apiVersion3], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.serverName, Parameters.databaseName ], headerParameters: [Parameters.contentType, Parameters.accept], mediaType: "json", serializer };