Skip to content

Commit 349cbbd

Browse files
author
Thibaud Baas
committed
fm: Instance settings update
1 parent 3da4edd commit 349cbbd

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

dataikuapi/fm/instances.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,43 @@ def delete(self):
6565
future = self.client._perform_tenant_json("GET", "/instances/%s/actions/delete" % self.id)
6666
return FMFuture.from_resp(self.client, future)
6767

68+
def set_automated_snapshots(self, enable, period, keep=0):
69+
"""
70+
Set the automated snapshots policy for this instance
71+
72+
:param boolean enable: Enable the automated snapshots
73+
:param int period: The time period between 2 snapshot in hours
74+
:param int keep: Optional, the number of snapshot to keep. Use 0 to keep all snapshots. Defaults to 0.
75+
"""
76+
self.instance_data['enableAutomatedSnapshot'] = enable
77+
self.instance_data['automatedSnapshotPeriod'] = period
78+
self.instance_data['automatedSnapshotRetention'] = keep
79+
self.save()
80+
81+
def set_elastic_ip(self, enable, elasticip_allocation_id):
82+
"""
83+
Set a public elastic ip for this instance
84+
85+
:param boolan enable: Enable the elastic ip allocation
86+
:param str elaticip_allocation_id: The AWS ElasticIP allocation ID or the Azure Public IP ID
87+
"""
88+
self.instance_data['awsAssignElasticIP'] = enable
89+
self.instance_data['awsElasticIPAllocationId'] = elasticip_allocation_id
90+
self.instance_data['azureAssignElasticIP'] = enable
91+
self.instance_data['azurePublicIPId'] = elasticip_allocation_id
92+
self.save()
93+
94+
def set_custom_certificate(self, pem_data):
95+
"""
96+
Set the custom certificate for this instance
97+
98+
Only needed when Virtual Network HTTPS Strategy is set to Custom Certificate
99+
100+
param: str pem_data: The SSL certificate
101+
"""
102+
self.instance_data['sslCertificatePEM'] = pem_data
103+
self.save()
104+
68105

69106
class FMInstanceEncryptionMode(Enum):
70107
NONE = "NONE"

0 commit comments

Comments
 (0)