Skip to content

Commit 9f8f716

Browse files
Merge pull request #264 from dataiku/feature/dss110-sc-85515-dcs-fm-all-add-information-related-to-the
Feature/dss110 sc 85515 dcs fm all add information related to the
2 parents b2aaa41 + d025e2e commit 9f8f716

File tree

6 files changed

+159
-113
lines changed

6 files changed

+159
-113
lines changed

Diff for: dataikuapi/fm/future.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ def __init__(
1717

1818
@staticmethod
1919
def from_resp(client, resp, result_wrapper=lambda result: result):
20-
"""Creates a DSSFuture from a parsed JSON response"""
20+
"""
21+
Creates a DSSFuture from a parsed JSON response
22+
23+
:rtype: :class:`dataikuapi.fm.future.FMFuture`
24+
"""
2125
return FMFuture(
2226
client, resp.get("jobId", None), state=resp, result_wrapper=result_wrapper
2327
)

Diff for: dataikuapi/fm/instances.py

+45-35
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ def __init__(
1717
"""
1818
Helper to create a DSS Instance
1919
20-
:param object client: :class:`dataikuapi.fm.fmclient`
20+
:param client: The FM client
21+
:type client: :class:`dataikuapi.fm.fmclient`
2122
:param str label: The label of the instance
2223
:param str instance_settings_template: The instance settings template id this instance should be based on
2324
:param str virtual_network: The virtual network where the instance should be spawned
@@ -37,7 +38,7 @@ def with_dss_node_type(self, dss_node_type):
3738
"""
3839
Set the DSS Node type of the instance to create
3940
40-
:param str dss_node_type: Optional , the type of the dss node to create. Supports "design", "automation ordeployer". Defaults to "design"
41+
:param str dss_node_type: Optional , the type of the dss node to create. Supports "design", "automation" or "deployer". Defaults to "design"
4142
:rtype: :class:`dataikuapi.fm.instances.FMInstanceCreator`
4243
"""
4344
if dss_node_type not in ["design", "automation", "deployer"]:
@@ -51,7 +52,7 @@ def with_cloud_instance_type(self, cloud_instance_type):
5152
"""
5253
Set the machine type for the DSS Instance
5354
54-
:param str cloud_instance_type
55+
:param str cloud_instance_type: the machine type to be used for the instance
5556
:rtype: :class:`dataikuapi.fm.instances.FMInstanceCreator`
5657
"""
5758
self.data["cloudInstanceType"] = cloud_instance_type
@@ -69,11 +70,12 @@ def with_data_volume_options(
6970
"""
7071
Set the options of the data volume to use with the DSS Instance
7172
72-
:param str data_volume_type: Optional, Data volume type
73-
:param int data_volume_size: Optional, Data volume initial size
74-
:param int data_volume_size_max: Optional, Data volume maximum size
75-
:param int data_volume_IOPS: Optional, Data volume IOPS
76-
:param object data_volume_encryption: Optional, a :class:`dataikuapi.fm.instances.FMInstanceEncryptionMode` setting the encryption mode of the data volume
73+
:param str data_volume_type: Optional, data volume type
74+
:param int data_volume_size: Optional, data volume initial size
75+
:param int data_volume_size_max: Optional, data volume maximum size
76+
:param int data_volume_IOPS: Optional, data volume IOPS
77+
:param data_volume_encryption: Optional, encryption mode of the data volume
78+
:type data_volume_encryption: :class:`dataikuapi.fm.instances.FMInstanceEncryptionMode`
7779
:param str data_volume_encryption_key: Optional, the encryption key to use when data_volume_encryption_key is FMInstanceEncryptionMode.CUSTOM
7880
:rtype: :class:`dataikuapi.fm.instances.FMInstanceCreator`
7981
"""
@@ -135,7 +137,7 @@ def create(self):
135137
"""
136138
Create the DSS instance
137139
138-
:return: Created DSS Instance
140+
:return: a newly created DSS instance
139141
:rtype: :class:`dataikuapi.fm.instances.FMAWSInstance`
140142
"""
141143
instance = self.client._perform_tenant_json(
@@ -149,7 +151,7 @@ def create(self):
149151
"""
150152
Create the DSS instance
151153
152-
:return: Created DSS Instance
154+
:return: a newly created DSS instance
153155
:rtype: :class:`dataikuapi.fm.instances.FMAzureInstance`
154156
"""
155157
instance = self.client._perform_tenant_json(
@@ -163,7 +165,7 @@ def create(self):
163165
"""
164166
Create the DSS instance
165167
166-
:return: Created DSS Instance
168+
:return: a newly created DSS instance
167169
:rtype: :class:`dataikuapi.fm.instances.FMGCPInstance`
168170
"""
169171
instance = self.client._perform_tenant_json(
@@ -175,7 +177,12 @@ def create(self):
175177
class FMInstance(object):
176178
"""
177179
A handle to interact with a DSS instance.
178-
Do not create this directly, use :meth:`FMClient.get_instance` or :meth: `FMClient.new_instance_creator`
180+
Do not create this directly, use :meth:`dataikuapi.fmclient.FMClient.get_instance` or
181+
182+
* :meth:`dataikuapi.fmclient.FMClientAWS.new_instance_creator`
183+
* :meth:`dataikuapi.fmclient.FMClientAzure.new_instance_creator`
184+
* :meth:`dataikuapi.fmclient.FMClientGCP.new_instance_creator`
185+
179186
"""
180187

181188
def __init__(self, client, instance_data):
@@ -187,8 +194,8 @@ def reprovision(self):
187194
"""
188195
Reprovision the physical DSS instance
189196
190-
:return: A :class:`~dataikuapi.fm.future.FMFuture` representing the reprovision process
191-
:rtype: :class:`~dataikuapi.fm.future.FMFuture`
197+
:return: the `Future` object representing the reprovision process
198+
:rtype: :class:`dataikuapi.fm.future.FMFuture`
192199
"""
193200
future = self.client._perform_tenant_json(
194201
"GET", "/instances/%s/actions/reprovision" % self.id
@@ -199,8 +206,8 @@ def deprovision(self):
199206
"""
200207
Deprovision the physical DSS instance
201208
202-
:return: A :class:`~dataikuapi.fm.future.FMFuture` representing the deprovision process
203-
:rtype: :class:`~dataikuapi.fm.future.FMFuture`
209+
:return: the `Future` object representing the deprovision process
210+
:rtype: :class:`dataikuapi.fm.future.FMFuture`
204211
"""
205212
future = self.client._perform_tenant_json(
206213
"GET", "/instances/%s/actions/deprovision" % self.id
@@ -211,8 +218,8 @@ def restart_dss(self):
211218
"""
212219
Restart the DSS running on the physical instance
213220
214-
:return: A :class:`~dataikuapi.fm.future.FMFuture` representing the restart process
215-
:rtype: :class:`~dataikuapi.fm.future.FMFuture`
221+
:return: the `Future` object representing the restart process
222+
:rtype: :class:`dataikuapi.fm.future.FMFuture`
216223
"""
217224
future = self.client._perform_tenant_json(
218225
"GET", "/instances/%s/actions/restart-dss" % self.id
@@ -221,7 +228,7 @@ def restart_dss(self):
221228

222229
def save(self):
223230
"""
224-
Update the Instance.
231+
Update the instance
225232
"""
226233
self.client._perform_tenant_empty(
227234
"PUT", "/instances/%s" % self.id, body=self.instance_data
@@ -233,6 +240,9 @@ def save(self):
233240
def get_status(self):
234241
"""
235242
Get the physical DSS instance's status
243+
244+
:return: the instance status
245+
:rtype: :class:`dataikuapi.fm.instances.FMInstanceStatus`
236246
"""
237247
status = self.client._perform_tenant_json(
238248
"GET", "/instances/%s/status" % self.id
@@ -243,8 +253,8 @@ def delete(self):
243253
"""
244254
Delete the DSS instance
245255
246-
:return: A :class:`~dataikuapi.fm.future.FMFuture` representing the deletion process
247-
:rtype: :class:`~dataikuapi.fm.future.FMFuture`
256+
:return: the `Future` object representing the deletion process
257+
:rtype: :class:`dataikuapi.fm.future.FMFuture`
248258
"""
249259
future = self.client._perform_tenant_json(
250260
"GET", "/instances/%s/actions/delete" % self.id
@@ -269,8 +279,8 @@ def reset_user_password(self, username, password):
269279
270280
:param string username: login
271281
:param string password: new password
272-
:return: A :class:`~dataikuapi.fm.future.FMFuture` representing the password reset process
273-
:rtype: :class:`~dataikuapi.fm.future.FMFuture`
282+
:return: the `Future` object representing the password reset process
283+
:rtype: :class:`dataikuapi.fm.future.FMFuture`
274284
"""
275285
future = self.client._perform_tenant_json(
276286
"GET", "/instances/%s/actions/reset-user-password" % self.id, params={ 'userName':username, 'password':password }
@@ -281,8 +291,8 @@ def replay_setup_actions(self):
281291
"""
282292
Replay the setup actions on the DSS instance
283293
284-
:return: A :class:`~dataikuapi.fm.future.FMFuture` representing the replay process
285-
:rtype: :class:`~dataikuapi.fm.future.FMFuture`
294+
:return: the `Future` object representing the replay process
295+
:rtype: :class:`dataikuapi.fm.future.FMFuture`
286296
"""
287297
future = self.client._perform_tenant_json(
288298
"GET", "/instances/%s/actions/replay-setup-actions" % self.id
@@ -291,7 +301,7 @@ def replay_setup_actions(self):
291301

292302
def set_automated_snapshots(self, enable, period, keep=0):
293303
"""
294-
Set the automated snapshots policy for this instance
304+
Set the automated snapshot policy for this instance
295305
296306
:param boolean enable: Enable the automated snapshots
297307
:param int period: The time period between 2 snapshot in hours
@@ -308,7 +318,7 @@ def set_custom_certificate(self, pem_data):
308318
309319
Only needed when Virtual Network HTTPS Strategy is set to Custom Certificate
310320
311-
param: str pem_data: The SSL certificate
321+
:param str pem_data: The SSL certificate
312322
"""
313323
self.instance_data["sslCertificatePEM"] = pem_data
314324
return self
@@ -320,7 +330,7 @@ def set_custom_certificate(self, pem_data):
320330

321331
def list_snapshots(self):
322332
"""
323-
List all snapshots of this instance
333+
List all the snapshots of this instance
324334
325335
:return: list of snapshots
326336
:rtype: list of :class:`dataikuapi.fm.instances.FMSnapshot`
@@ -341,7 +351,7 @@ def get_snapshot(self, snapshot_id):
341351

342352
def snapshot(self, reason_for_snapshot=None):
343353
"""
344-
Create a snapshot of the DSS instance
354+
Create a snapshot of the instance
345355
346356
:return: Snapshot
347357
:rtype: :class:`dataikuapi.fm.instances.FMSnapshot`
@@ -357,7 +367,7 @@ def set_elastic_ip(self, enable, elasticip_allocation_id):
357367
Set a public elastic ip for this instance
358368
359369
:param boolan enable: Enable the elastic ip allocation
360-
:param str elaticip_allocation_id: AWS ElasticIP allocation ID
370+
:param str elasticip_allocation_id: AWS ElasticIP allocation ID
361371
"""
362372
self.instance_data["awsAssignElasticIP"] = enable
363373
self.instance_data["awsElasticIPAllocationId"] = elasticip_allocation_id
@@ -399,7 +409,7 @@ class FMInstanceEncryptionMode(Enum):
399409

400410
class FMInstanceStatus(dict):
401411
"""A class holding read-only information about an Instance.
402-
This class should not be created directly. Instead, use :meth:`FMInstance.get_info`
412+
This class should not be created directly. Instead, use :meth:`FMInstance.get_status`
403413
"""
404414

405415
def __init__(self, data):
@@ -435,8 +445,8 @@ def reprovision(self):
435445
"""
436446
Reprovision the physical DSS instance from this snapshot
437447
438-
:return: A :class:`~dataikuapi.fm.future.FMFuture` representing the reprovision process
439-
:rtype: :class:`~dataikuapi.fm.future.FMFuture`
448+
:return: the `Future` object representing the reprovision process
449+
:rtype: :class:`dataikuapi.fm.future.FMFuture`
440450
"""
441451
future = self.client._perform_tenant_json(
442452
"POST", "/instances/%s/snapshots/%s/reprovision" % (self.instance_id, self.snapshot_id)
@@ -447,8 +457,8 @@ def delete(self):
447457
"""
448458
Delete the snapshot
449459
450-
:return: A :class:`~dataikuapi.fm.future.FMFuture` representing the deletion process
451-
:rtype: :class:`~dataikuapi.fm.future.FMFuture`
460+
:return: the `Future` object representing the deletion process
461+
:rtype: :class:`dataikuapi.fm.future.FMFuture`
452462
"""
453463
future = self.client._perform_tenant_json(
454464
"DELETE", "/instances/%s/snapshots/%s" % (self.instance_id, self.snapshot_id)

0 commit comments

Comments
 (0)