Skip to content

Add API deployer infra creation #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions dataikuapi/dss/apideployer.py
Original file line number Diff line number Diff line change
@@ -70,12 +70,29 @@ def list_infras(self, as_objects = True):
else:
return l

def create_infra(self, infra_id, stage, type):
"""
Creates a new infrastructure on the API Deployer and returns the handle to interact with it.

:param str infra_id: Unique Identifier of the infra to create
:param str stage: Infrastructure stage. Stages are configurable on each API Deployer
:param str type: STATIC or KUBERNETES
:rtype: :class:`DSSAPIDeployerInfra`
"""
settings = {
"id": infra_id,
"stage": stage,
"type": type,
}
self.client._perform_json("POST", "/api-deployer/infras", body=settings)
return self.get_infra(infra_id)

def get_infra(self, infra_id):
"""
Returns a handle to interact with a single deployment infra, as a :class:`DSSAPIDeployerInfra`

:param str infra_id: Identifier of the infra to get
:rtype: :class:`DSSAPIDeployerDeployment`
:rtype: :class:`DSSAPIDeployerInfra`
"""
return DSSAPIDeployerInfra(self.client, infra_id)

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