Presentation
The saagieapi python package implements python API wrappers to
easily interact with the Saagie platform in python.
Contents
- Platform
- Projects
- Creating a project
- Deleting a project
- Editing a project
- Exporting a project
- Getting available app technologies for a project
- Getting project id from name
- Getting project information
- Getting available jobs technologies for a project
- Getting rights information for a project
- Importing a project
- Listing projects
- Jobs
- Creating a job
- Creating or upgrading a job
- Deleting a job
- Editing a job
- Exporting a job
- Getting job information
- Getting job instance information
- Getting job id from name
- Importing a job
- Listing jobs for a project
- Listing jobs for a project (with minimal information)
- Rollback a job
- Running a job
- Running a job with callback
- Stopping a job
- Upgrading a job by job ID
- Upgrading a job by its name
- Apps
- Creating app from catalog
- Creating app from Docker image
- Deleting an app
- Editing an app
- Exporting an app
- Getting apps information
- Getting app id from name
- Getting app technology runtime label by ID
- Importing an app
- Listing apps for a project
- Listing apps for a project (with minimal information)
- Rollback an app
- Running an app
- Stopping an app
- Upgrading an app
- Pipelines
- Creating or upgrading a pipeline
- Creating a pipeline
- Deleting a pipeline
- Editing a pipeline
- Exporting a pipeline
- Getting pipeline information
- Getting pipeline instance information
- Getting pipeline id from project name and pipeline name
- Importing a pipeline
- Listing pipelines for a project
- Listing pipelines for a project (with minimal information)
- Rollback a pipeline
- Running a pipeline
- Running with callback a pipeline
- Stopping a pipeline
- Upgrading a pipeline
- Environment Variables
- Docker Credentials
- Storages
- Repositories
- Technologies
Installing
pip install saagieapi==<version>
Compatibility with your Saagie platform
Saagie platform version |
saagie-api release |
|---|---|
< 2.2.0 |
< 0.6.0 |
>= 2.2.0 |
>= 0.6.0 |
>= 2023.01 |
>= 2.4.0 |
Usage
Connecting to your platform
There are 2 options to connect to your platform :
using the default constructor :
saagie = SaagieApi(url_saagie="<url>",
id_platform="1",
user="<saagie-user-name>",
password="<saagie-user-password>",
realm="saagie")
Using the
easy_connectalternative constructor which uses the complete URL (eg: https://mysaagie-workspace.prod.saagie.com/projects/platform/6/) and will parse it in order to retrieve the platform URL, platform id and the realm.
saagie = SaagieApi.easy_connect(url_saagie_platform="<url>",
user="<saagie-user-name>",
password="<saagie-user-password>")
Using the different endpoints
Once connected with one of the 2 methods explained above, you can now use the different endpoints to interact with:
platform :
saagie.xxx, see Platform for the detailsprojects :
saagie.projects.xxx, see Projects for the detailsjobs :
saagie.jobs.xxx, see Jobs for the detailsapps :
saagie.apps.xxx, see Apps for the detailspipelines :
saagie.pipelines.xxx, see Pipelines for the detailsenvironment variables :
saagie.env_vars.xxx, see Environement Variables for the detailsdocker credentials :
saagie.docker_credentials.xxx, see Docker Credentials for the detailsstorages :
saagie.storages.xxx, see Storages for the detailsrepositories :
saagie.repositories.xxx, see Repositories for the details
Finding your platform, project, job and instances ids
Your Saagie projects homepage has the following structure
https://<REALM>-workspace.me.saagie.com/projects/platform/<PLATFORM_ID>/
https://mysaagie-workspace.me.saagie.com/projects/platform/1/
would give :
- platform_id = 1
- realm = mysaagie
Project id can be found in the project URL after the /project
https://mysaagie-workspace.me.saagie.com/projects/platform/1/project/8321e13c-892a-4481-8552-5be4b6cc5df4/jobs
would give :
- project_id = 8321e13c-892a-4481-8552-5be4b6cc5df4
Job id can be found in the project URL after the /job
https://mysaagie-workspace.me.saagie.com/projects/platform/1/project/8321e13c-892a-4481-8552-5be4b6cc5df4/job/a85ac3db-bca1-4f15-b8f7-44731fba874b
would give :
- job_id = a85ac3db-bca1-4f15-b8f7-44731fba874b
App id can be found in the project URL after the /app
https://mysaagie-workspace.me.saagie.com/projects/platform/1/project/8321e13c-892a-4481-8552-5be4b6cc5df4/app/02c01d47-8a29-47d0-a53c-235add43c885
would give :
- app_id = 02c01d47-8a29-47d0-a53c-235add43c885
Pipeline id can be found in the project URL after the /pipeline
https://mysaagie-workspace.me.saagie.com/projects/platform/1/project/8321e13c-892a-4481-8552-5be4b6cc5df4/pipeline/4da29f25-e7c9-4410-869e-40b9ba0074d1
would give :
- pipeline_id = 4da29f25-e7c9-4410-869e-40b9ba0074d1
Job instance id can be found in the project URL after the
/instances
https://mysaagie-workspace.me.saagie.com/projects/platform/1/project/8321e13c-892a-4481-8552-5be4b6cc5df4/job/a85ac3db-bca1-4f15-b8f7-44731fba874b/instances/6ff448ae-3770-4639-b0f8-079e5c614ab6
would give :
- job_instance_id = 6ff448ae-3770-4639-b0f8-079e5c614ab6