Skip to content

Commit 6ea6d7b

Browse files
committed
api deployer: Add create_infra method
1 parent f345c2b commit 6ea6d7b

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

dataikuapi/dss/apideployer.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,30 @@ 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+
pass
83+
settings = {
84+
"infraId" : infra_id,
85+
"stage:" stage,
86+
"type": type,
87+
}
88+
self.client._perform_json("POST", "/api-deployer/infras", body=settings)
89+
return self.get_infra(infra_id)
90+
7391
def get_infra(self, infra_id):
7492
"""
7593
Returns a handle to interact with a single deployment infra, as a :class:`DSSAPIDeployerInfra`
7694
7795
:param str infra_id: Identifier of the infra to get
78-
:rtype: :class:`DSSAPIDeployerDeployment`
96+
:rtype: :class:`DSSAPIDeployerInfra`
7997
"""
8098
return DSSAPIDeployerInfra(self.client, infra_id)
8199

@@ -453,4 +471,4 @@ def get_raw(self):
453471
Gets the raw status information. This returns a dictionary with various information about the service,
454472
:rtype: dict
455473
"""
456-
return self.light_status
474+
return self.light_status

0 commit comments

Comments
 (0)