import { UIM_CLUSTER_ADD , UIM_CLUSTER_UPDATE } from '../constants' ; import { trackUserRequest } from './ui_metric' ; import { sendGet , sendPost , sendPut , sendDelete , SendGetOptions } from './http' ; import { Cluster } from '../../../common/lib' ; export async function loadClusters ( options ? ) { return await sendGet ( undefined , options ) ; } export async function addCluster ( cluster ) { const request = sendPost ( '' , cluster ) ; return await trackUserRequest ( request , UIM_CLUSTER_ADD ) ; } export async function editCluster ( cluster ) { const { name , ... rest } = cluster ; const request = sendPut ( name , rest ) ; return await trackUserRequest ( request , UIM_CLUSTER_UPDATE ) ; } export function removeClusterRequest ( name ) { return sendDelete ( name ) ; }