Class: Databricks::Resources::Clusters
- Inherits:
-
Databricks::Resource
- Object
- Databricks::Resource
- Databricks::Resources::Clusters
- Defined in:
- lib/databricks/resources/clusters.rb
Overview
Provide the Clusters API cf. docs.databricks.com/dev-tools/api/latest/clusters.html
Instance Method Summary collapse
-
#create(**properties) ⇒ Object
Create a new cluster.
-
#get(cluster_id) ⇒ Object
Get a cluster based on its cluster_id.
-
#list ⇒ Object
List clusters.
Methods inherited from Databricks::Resource
#add_properties, #initialize, #inspect, #new_resource, #sub_resource, sub_resources
Constructor Details
This class inherits a constructor from Databricks::Resource
Instance Method Details
#create(**properties) ⇒ Object
Create a new cluster.
- Parameters
-
properties (Hash<Symbol,Object>): Properties to create the cluster
- Result
-
Cluster: The new cluster created
33 34 35 36 37 |
# 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) ⇒ Object
Get a cluster based on its cluster_id
- Parameters
-
cluster_id (String): The cluster id to get
- Result
-
Cluster: The cluster
23 24 25 |
# 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 ⇒ Object
List clusters
- Result
-
Array<Cluster>: List of clusters
13 14 15 |
# File 'lib/databricks/resources/clusters.rb', line 13 def list (get_json('clusters/list')['clusters'] || []).map { |properties| new_resource(:cluster, properties) } end |