Databricks C++ SDK 0.2.4
Interact with Databricks via an SDK
Loading...
Searching...
No Matches
databricks::Compute Class Reference

Client for interacting with the Databricks Clusters/Compute API. More...

#include <compute.h>

Public Member Functions

 Compute (const AuthConfig &auth)
 Construct a Compute API client.
 
 Compute (std::shared_ptr< internal::IHttpClient > http_client)
 Construct a Compute API client with dependency injection (for testing)
 
 ~Compute ()
 Destructor.
 
 Compute (const Compute &)=delete
 
Computeoperator= (const Compute &)=delete
 
std::vector< Clusterlist_compute ()
 List all compute clusters in the workspace.
 
bool create_compute (const Cluster &cluster_config)
 Create a new Spark Cluster.
 
Cluster get_compute (const std::string &cluster_id)
 Get detailed information about a specific compute cluster.
 
bool start_compute (const std::string &cluster_id)
 Start a terminated compute cluster.
 
bool terminate_compute (const std::string &cluster_id)
 Terminate a running compute cluster.
 
bool restart_compute (const std::string &cluster_id)
 Restart a compute cluster.
 

Detailed Description

Client for interacting with the Databricks Clusters/Compute API.

The Clusters API allows you to create, manage, and control compute clusters in your Databricks workspace. This implementation uses Clusters API 2.0.

Example usage:

databricks::Compute compute(auth);
// List all compute clusters
auto cluster_list = compute.list_compute();
// Get specific compute cluster details
auto cluster = compute.get_compute("1234-567890-abcde123");
// Start a terminated compute cluster
compute.start_compute("1234-567890-abcde123");
Client for interacting with the Databricks Clusters/Compute API.
Definition compute.h:37
Core authentication configuration shared across all Databricks features.
Definition config.h:16
static AuthConfig from_environment(const std::string &profile="DEFAULT")
Load authentication configuration from all available sources.

Definition at line 37 of file compute.h.

Constructor & Destructor Documentation

◆ Compute() [1/3]

databricks::Compute::Compute ( const AuthConfig auth)
explicit

Construct a Compute API client.

Parameters
authAuthentication configuration with host and token

◆ Compute() [2/3]

databricks::Compute::Compute ( std::shared_ptr< internal::IHttpClient >  http_client)
explicit

Construct a Compute API client with dependency injection (for testing)

Parameters
http_clientInjected HTTP client (use MockHttpClient for unit tests)
Note
This constructor is primarily for testing with mock HTTP clients

◆ ~Compute()

databricks::Compute::~Compute ( )

Destructor.

◆ Compute() [3/3]

databricks::Compute::Compute ( const Compute )
delete

Member Function Documentation

◆ create_compute()

bool databricks::Compute::create_compute ( const Cluster cluster_config)

Create a new Spark Cluster.

Parameters
clusterCreate a cluster in Databricks with Cluster Configs
Returns
true if the operation was successful

◆ get_compute()

Cluster databricks::Compute::get_compute ( const std::string &  cluster_id)

Get detailed information about a specific compute cluster.

Parameters
cluster_idThe unique identifier of the cluster
Returns
Cluster object with full details
Exceptions
std::runtime_errorif the cluster is not found or the API request fails

◆ list_compute()

std::vector< Cluster > databricks::Compute::list_compute ( )

List all compute clusters in the workspace.

Returns
Vector of Cluster objects
Exceptions
std::runtime_errorif the API request fails

◆ operator=()

Compute & databricks::Compute::operator= ( const Compute )
delete

◆ restart_compute()

bool databricks::Compute::restart_compute ( const std::string &  cluster_id)

Restart a compute cluster.

Parameters
cluster_idThe unique identifier of the cluster to restart
Returns
true if the operation was successful
Exceptions
std::runtime_errorif the API request fails
Note
This will terminate and then start the cluster with the same configuration.

◆ start_compute()

bool databricks::Compute::start_compute ( const std::string &  cluster_id)

Start a terminated compute cluster.

Parameters
cluster_idThe unique identifier of the cluster to start
Returns
true if the operation was successful
Exceptions
std::runtime_errorif the API request fails

◆ terminate_compute()

bool databricks::Compute::terminate_compute ( const std::string &  cluster_id)

Terminate a running compute cluster.

Parameters
cluster_idThe unique identifier of the cluster to terminate
Returns
true if the operation was successful
Exceptions
std::runtime_errorif the API request fails
Note
This stops the cluster but does not permanently delete it. Terminated clusters can be restarted.

The documentation for this class was generated from the following file: