/* 
  AUTOGENERATED FILE
  Run "npm run generateARMClients" to regenerate
  Edting this file directly should be done with extreme caution as not to diverge from ARM REST specs

  Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-03-01/bigDataPool.json
*/

import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request";
import * as Types from "./types";
const apiVersion = "2021-03-01";

/* Get a Big Data pool. */
export async function get(
  subscriptionId: string,
  resourceGroupName: string,
  workspaceName: string,
  bigDataPoolName: string,
): Promise<Types.BigDataPoolResourceInfo> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/bigDataPools/${bigDataPoolName}`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
}

/* Patch a Big Data pool. */
export async function update(
  subscriptionId: string,
  resourceGroupName: string,
  workspaceName: string,
  bigDataPoolName: string,
  body: Types.BigDataPoolPatchInfo,
): Promise<Types.BigDataPoolResourceInfo> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/bigDataPools/${bigDataPoolName}`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PATCH", apiVersion, body });
}

/* Create a new Big Data pool. */
export async function createOrUpdate(
  subscriptionId: string,
  resourceGroupName: string,
  workspaceName: string,
  bigDataPoolName: string,
  body: Types.BigDataPoolResourceInfo,
): Promise<Types.BigDataPoolResourceInfo> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/bigDataPools/${bigDataPoolName}`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "PUT", apiVersion, body });
}

/* Delete a Big Data pool from the workspace. */
export async function destroy(
  subscriptionId: string,
  resourceGroupName: string,
  workspaceName: string,
  bigDataPoolName: string,
): Promise<void> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/bigDataPools/${bigDataPoolName}`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "DELETE", apiVersion });
}

/* List Big Data pools in a workspace. */
export async function listByWorkspace(
  subscriptionId: string,
  resourceGroupName: string,
  workspaceName: string,
): Promise<Types.BigDataPoolResourceInfoListResult> {
  const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Synapse/workspaces/${workspaceName}/bigDataPools`;
  return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
}
