Docker Credentials#

class saagieapi.docker_credentials.DockerCredentials(saagie_api)#

Bases: object

create(project_id: str, username: str, password: str, registry: str = None) Dict#

Create docker credentials for a specific project

Parameters:
  • project_id (str) – ID of the project

  • username (str) – Login to the container registry

  • password (str) – Password to the container registry

  • registry (str, optional) – If you do not set a registry, the registry will be Docker Hub. Else, you have to put the url of the container registry

Returns:

Dict of the created docker credentials

Return type:

dict

Examples

>>> saagieapi.docker_credentials.create(
...     project_id="860b8dc8-e734-4c98-b2e7-f9ec32ab4771",
...     username="myuser",
...     password="mypassword"
... )
{
    "createDockerCredentials":{
        "id":"0cb2662f-84eb-4a7d-93cb-2340f7773bce",
        "registry":None,
        "username":"myuser",
        "lastUpdate":"2022-04-26T14:20:17.138482Z[UTC]"
    }
}
delete(project_id: str, credential_id: str) Dict#

Delete a specific container registry credentials in a specific project

Parameters:
  • project_id – ID of the project

  • credential_id (str) – ID of the credential

Returns:

Dict of the deleted docker credentials

Return type:

dict

Examples

>>> saagieapi.docker_credentials.delete(
...     project_id="860b8dc8-e734-4c98-b2e7-f9ec32ab4771",
...     credential_id="0cb2662f-84eb-4a7d-93cb-2340f7773bce"
... )
{
    'deleteDockerCredentials': True
}
delete_for_username(project_id: str, username: str, registry: str = None) Dict#

Delete a specific container registry credentials in a specific project

Parameters:
  • project_id – ID of the project

  • username (str) – Login to the container registry

  • registry (str, optional) – If you do not set a registry, the registry will be Docker Hub. Otherwise, you have to put the url of the container registry

Returns:

Dict of the deleted docker credentials

Return type:

dict

Examples

>>> saagieapi.docker_credentials.delete_for_username(
...     project_id="860b8dc8-e734-4c98-b2e7-f9ec32ab4771",
...     username="myuser"
... )
{
    'deleteDockerCredentials': True
}
get_info(project_id: str, credential_id: str, pprint_result: bool | None = None) Dict#

Get the info of a specific docker credentials in a specific project

Parameters:
  • project_id – ID of the project

  • credential_id (str) – ID of the credentials of the container registry pprint_result : bool, optional Whether to pretty print the result of the query, default to saagie_api.pprint_global

Returns:

Dict of the info of the docker credentials

Return type:

dict

Examples

>>> saagieapi.docker_credentials.get_info(
...     project_id="860b8dc8-e734-4c98-b2e7-f9ec32ab4771",
...     credential_id="0cb2662f-84eb-4a7d-93cb-2340f7773bce"
... )
{
    "dockerCredentials":{
        "id":"0cb2662f-84eb-4a7d-93cb-2340f7773bce",
        "registry":None,
        "username":"myuser",
        "lastUpdate":"2022-04-27T08:15:41.023Z",
        "jobs":[]
    }
}
get_info_for_username(project_id: str, username: str, registry: str = None) Dict#

Get the info of a specific docker credentials in a specific project using the username and the registry

Parameters:
  • project_id – ID of the project

  • username (str) – Login of the container registry

  • registry (str, optional) – If you do not set a registry, the registry will be Docker Hub.

Returns:

Dict of the info of the docker credentials

Return type:

dict

Examples

>>> saagieapi.docker_credentials.get_info_for_username(
...     project_id="860b8dc8-e734-4c98-b2e7-f9ec32ab4771",
...     username="myuser"
... )
{
    "id":"0cb2662f-84eb-4a7d-93cb-2340f7773bce",
    "registry":None,
    "username":"myuser",
    "lastUpdate":"2022-04-26T14:20:17.118Z",
    "jobs": []
}
list_for_project(project_id: str, pprint_result: bool | None = None) Dict#

Get all saved docker credentials for a specific project

Parameters:
  • project_id (str) – ID of the project

  • pprint_result (bool, optional) – Whether to pretty print the result of the query, default to saagie_api.pprint_global

Returns:

Dict of all docker credentials for a specific project

Return type:

dict

Examples

>>> saagie.docker_credentials.list_for_project(project_id="123456789")
{
    "allDockerCredentials":[
        {
            "id":"0cb2662f-84eb-4a7d-93cb-2340f7773bce",
            "registry":None,
            "username":"myuser",
            "lastUpdate":"2022-04-26T14:20:17.118Z",
            "jobs":[]
        }
    ]
}
upgrade(project_id: str, credential_id: str, password: str, registry: str = None, username: str = '') Dict#

Update docker credentials for a specific project

Parameters:
  • project_id (str) – ID of the project

  • credential_id (str) – ID of the created docker credentials

  • password (str) – Password to the container registry

  • registry (str, optional) – If you do not set a registry, the registry will be Docker Hub. Otherwise, you have to put the url of the container registry

  • username (str, optional) – If you want to change the login of the container registry, you have to set it. Otherwise, you can let it to default value

Returns:

Dict of the updated docker credentials

Return type:

dict

Examples

>>> saagieapi.docker_credentials.upgrade(
...     project_id="860b8dc8-e734-4c98-b2e7-f9ec32ab4771",
...     credential_id="0cb2662f-84eb-4a7d-93cb-2340f7773bce",
...     username="myuser",
...     password="mypassword"
... )
{
    "updateDockerCredentials":{
        "id":"0cb2662f-84eb-4a7d-93cb-2340f7773bce",
        "registry":None,
        "username":"myuser",
        "lastUpdate":"2022-04-26T14:20:17.138482Z[UTC]"
    }
}
upgrade_for_username(project_id: str, username: str, password: str, registry: str = None) Dict#

Update docker credentials for a specific project

Parameters:
  • project_id (str) – ID of the project

  • username (str) – Login of the container registry

  • password (str) – Password to the container registry

  • registry (str, optional) – If you do not set a registry, the registry will be Docker Hub. Otherwise, you have to put the url of the container registry

Returns:

Dict of the updated docker credentials

Return type:

dict

Examples

>>> saagieapi.docker_credentials.upgrade_for_username(
...     project_id="860b8dc8-e734-4c98-b2e7-f9ec32ab4771",
...     username="myuser",
...     password="mypassword"
... )
{
    "updateDockerCredentials":{
        "id":"0cb2662f-84eb-4a7d-93cb-2340f7773bce",
        "registry":None,
        "username":"myuser",
        "lastUpdate":"2022-04-26T14:20:17.138482Z[UTC]"
    }
}