class Databricks::Resources::Clusters

Provide the Clusters API cf. docs.databricks.com/dev-tools/api/latest/clusters.html

Public Instance Methods

create(**properties) click to toggle source

Create a new cluster.

Parameters
  • properties (Hash<Symbol,Object>): Properties to create the cluster

Result
  • Cluster: The new cluster created

# File lib/databricks/resources/clusters.rb, line 33
def create(**properties)
  cluster = new_resource(:cluster, post_json('clusters/create', properties))
  cluster.add_properties(properties)
  cluster
end
get(cluster_id) click to toggle source

Get a cluster based on its cluster_id

Parameters
  • cluster_id (String): The cluster id to get

Result
  • Cluster: The cluster

# File lib/databricks/resources/clusters.rb, line 23
def get(cluster_id)
  new_resource(:cluster, get_json('clusters/get', { cluster_id: cluster_id }))
end
list() click to toggle source

List clusters

Result
  • Array<Cluster>: List of clusters

# File lib/databricks/resources/clusters.rb, line 13
def list
  (get_json('clusters/list')['clusters'] || []).map { |properties| new_resource(:cluster, properties) }
end