Skip to content

Commit a43b1e5

Browse files
authored
Merge pull request #30 from dataiku/tasks/dss50-add-create-infra
Add API deployer infra creation
2 parents 10d7907 + dc825b5 commit a43b1e5

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

Diff for: dataikuapi/dss/apideployer.py

+19-2
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,29 @@ def list_infras(self, as_objects = True):
7070
else:
7171
return l
7272

73+
def create_infra(self, infra_id, stage, type):
74+
"""
75+
Creates a new infrastructure on the API Deployer and returns the handle to interact with it.
76+
77+
:param str infra_id: Unique Identifier of the infra to create
78+
:param str stage: Infrastructure stage. Stages are configurable on each API Deployer
79+
:param str type: STATIC or KUBERNETES
80+
:rtype: :class:`DSSAPIDeployerInfra`
81+
"""
82+
settings = {
83+
"id": infra_id,
84+
"stage": stage,
85+
"type": type,
86+
}
87+
self.client._perform_json("POST", "/api-deployer/infras", body=settings)
88+
return self.get_infra(infra_id)
89+
7390
def get_infra(self, infra_id):
7491
"""
7592
Returns a handle to interact with a single deployment infra, as a :class:`DSSAPIDeployerInfra`
7693
7794
:param str infra_id: Identifier of the infra to get
78-
:rtype: :class:`DSSAPIDeployerDeployment`
95+
:rtype: :class:`DSSAPIDeployerInfra`
7996
"""
8097
return DSSAPIDeployerInfra(self.client, infra_id)
8198

@@ -453,4 +470,4 @@ def get_raw(self):
453470
Gets the raw status information. This returns a dictionary with various information about the service,
454471
:rtype: dict
455472
"""
456-
return self.light_status
473+
return self.light_status

0 commit comments

Comments
 (0)