---
sidebar:
  label: roboto.image_registry.image_registry
  order: 1
title: roboto.image_registry.image_registry
---
## Module Contents

### ContainerCredentials

```python
class roboto.image_registry.image_registry.ContainerCredentials(/, **data: Any)
```

`from roboto.image_registry import ContainerCredentials`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/image_registry/image_registry.py#L28-L53)

Bases: `pydantic.BaseModel`

Temporary `docker login` credentials for one repository in Roboto's private image registry.

`ImageRegistry.get_temporary_credentials` returns them. They reach only the repository they were requested for, and stop working at `expiration`.

**Parameters**

- **data** (`Any`)

**Attributes**

- **ContainerCredentials.expiration** (`datetime.datetime`): Time the credentials expire.
- **ContainerCredentials.password** (`str`): Password to pass to `docker login`.
- **ContainerCredentials.registry_url** (`str`): URL of the registry to log in to, the server argument of `docker login`.
- **ContainerCredentials.username** (`str`): Username to pass to `docker login`.

#### ContainerCredentials.is_expired()

```python
def is_expired() -> bool
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/image_registry/image_registry.py#L47-L49)

Return whether the credentials have expired, as of now.

**Returns**

- `bool`

#### ContainerCredentials.to_dict()

```python
def to_dict() -> dict[str, Any]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/image_registry/image_registry.py#L51-L53)

Return the credentials as a JSON-compatible dictionary, with `expiration` as an ISO 8601 string.

**Returns**

- `dict[str, Any]`

### ImageRegistry

```python
class roboto.image_registry.image_registry.ImageRegistry(
    roboto_client: roboto.http.RobotoClient,
)
```

`from roboto.image_registry import ImageRegistry`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/image_registry/image_registry.py#L99-L328)

Client for Roboto's private image registry, which holds the container images an organization's actions run in.

An organization keeps its images in repositories, one image per tag. The `roboto images` CLI commands use this class to push, pull, list and delete images.

**Parameters**

- **roboto_client** (`roboto.http.RobotoClient`): Client to make requests to Roboto with.

#### ImageRegistry.create_repository()

```python
def create_repository(
    repository_name: str,
    immutable_image_tags: bool = False,
    org_id: Optional[str] = None,
) -> ImageRepository
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/image_registry/image_registry.py#L114-L144)

Create a repository in Roboto's private image registry, or return the one that already has this name.

Push images to the returned `repository_uri` with credentials from `get_temporary_credentials`.

**Parameters**

- **repository_name** (`str`): Name of the repository, without the organization's prefix. Roboto names the repository `<org_id>/<repository_name>` in lowercase.
- **immutable_image_tags** (`bool`): Whether the repository refuses a push that would point an existing tag at a different image. A repository that already exists keeps its own setting.
- **org_id** (`Optional[str]`): Organization to create the repository in. Required when the caller belongs to more than one organization; otherwise the caller's only organization.

**Returns**

- `ImageRepository`: Name and URI of the repository.

#### ImageRegistry.delete_image()

```python
def delete_image(image_uri: str, org_id: Optional[str] = None) -> None
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/image_registry/image_registry.py#L146-L164)

Delete a container image from Roboto's private image registry.

Deleting by tag removes that tag, and the image with it when that was its last tag. Deleting by digest removes the image and every tag on it. Deleting an image that no longer exists, or one outside the organization's repositories, succeeds and changes nothing.

**Parameters**

- **image_uri** (`str`): URI of the image, as `<repository_uri>:<image_tag>` or `<repository_uri>@<digest>`. A URI with neither names the `latest` tag.
- **org_id** (`Optional[str]`): Organization that owns the image's repository. Defaults to the organization the caller acts in.

**Returns**

- `None`

#### ImageRegistry.delete_repository()

```python
def delete_repository(
    repository_name: str,
    org_id: Optional[str] = None,
    force: bool = False,
) -> None
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/image_registry/image_registry.py#L166-L193)

Delete a repository from Roboto's private image registry.

Deleting a repository that no longer exists, or one outside the organization, succeeds and changes nothing.

**Parameters**

- **repository_name** (`str`): Name of the repository, as `<org_id>/<name>`. A name without the organization's prefix deletes nothing.
- **org_id** (`Optional[str]`): Organization that owns the repository. Defaults to the organization the caller acts in.
- **force** (`bool`): Whether to delete the repository's images along with it. `False` refuses to delete a repository that holds any image, tagged or untagged.

**Raises**

- [`RobotoConflictException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoConflictException): The repository holds images and `force` is `False`.

**Returns**

- `None`

#### ImageRegistry.get_container_image_record()

```python
def get_container_image_record(
    org_id: str,
    image_uri: str,
) -> roboto.image_registry.record.ContainerImageRecord
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/image_registry/image_registry.py#L195-L212)

Fetch the record of a tagged image in Roboto's private image registry.

**Parameters**

- **org_id** (`str`): ID of the organization that owns the image's repository.
- **image_uri** (`str`): URI of the image, as `<repository_uri>:<image_tag>`. A URI with no tag names the `latest` tag.

**Raises**

- [`RobotoNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoNotFoundException): The URI is outside Roboto's private image registry, names the image by digest, or names a tag that none of the organization's repositories holds.

**Returns**

- `roboto.image_registry.record.ContainerImageRecord`

#### ImageRegistry.get_temporary_credentials()

```python
def get_temporary_credentials(
    repository_uri: str,
    permissions: roboto.auth.Permissions = Permissions.ReadOnly,
    org_id: Optional[str] = None,
) -> ContainerCredentials
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/image_registry/image_registry.py#L214-L246)

Fetch temporary `docker login` credentials for one repository in Roboto's private image registry.

The credentials reach only the repository `repository_uri` names.

**Parameters**

- **repository_uri** (`str`): URI of the repository. A tag or digest on the URI is ignored.
- **permissions** (`roboto.auth.Permissions`): What the credentials allow. [`ReadOnly`](/docs/reference/python-sdk/roboto/auth/permissions#roboto.auth.permissions.Permissions.ReadOnly) pulls images; [`ReadWrite`](/docs/reference/python-sdk/roboto/auth/permissions#roboto.auth.permissions.Permissions.ReadWrite) also pushes them.
- **org_id** (`Optional[str]`): Organization to act in. Required when the caller belongs to more than one organization; otherwise the caller's only organization.

**Raises**

- [`RobotoInvalidRequestException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoInvalidRequestException): The URI is outside Roboto's private image registry, or no repository has it.
- [`RobotoUnauthorizedException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoUnauthorizedException): The repository belongs to another organization, or `permissions` is `ReadWrite` and the caller may not change the organization's actions.

**Returns**

- `ContainerCredentials`

#### ImageRegistry.list_images()

```python
def list_images(
    repository_name: Optional[str] = None,
    page_token: Optional[str] = None,
    org_id: Optional[str] = None,
) -> roboto.http.PaginatedList[roboto.image_registry.record.ContainerImageRecord]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/image_registry/image_registry.py#L248-L280)

List one page of the organization's tagged images in Roboto's private image registry.

Each tag has its own record, so an image with two tags appears twice; untagged images are left out. Pass the page's `next_token` as `page_token` to fetch the next page; it is `None` on the last page.

**Parameters**

- **repository_name** (`Optional[str]`): Name of the repository to list images from, as `<org_id>/<name>`. `None` lists images from every repository the organization owns. A name that matches none of them returns an empty page.
- **page_token** (`Optional[str]`): Token from a previous page's response that resumes the listing after it. `None` starts at the first page.
- **org_id** (`Optional[str]`): Organization to act in. Required when the caller belongs to more than one organization; otherwise the caller's only organization.

**Returns**

- `roboto.http.PaginatedList[roboto.image_registry.record.ContainerImageRecord]`

#### ImageRegistry.list_repositories()

```python
def list_repositories(
    page_token: Optional[str] = None,
    org_id: Optional[str] = None,
) -> roboto.http.PaginatedList[roboto.image_registry.record.ContainerImageRepositoryRecord]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/image_registry/image_registry.py#L282-L301)

List one page of the organization's repositories in Roboto's private image registry, ordered by name.

Pass the page's `next_token` as `page_token` to fetch the next page; it is `None` on the last page.

**Parameters**

- **page_token** (`Optional[str]`): Token from a previous page's response that resumes the listing after it. `None` starts at the first page.
- **org_id** (`Optional[str]`): Organization whose repositories to list. Defaults to the organization the caller acts in.

**Returns**

- `roboto.http.PaginatedList[roboto.image_registry.record.ContainerImageRepositoryRecord]`

#### ImageRegistry.repository_contains_image()

```python
def repository_contains_image(
    repository_name: str,
    image_tag: str,
    org_id: Optional[str] = None,
) -> bool
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/image_registry/image_registry.py#L303-L328)

Fetch whether a repository in Roboto's private image registry holds an image with this tag.

The answer is `True` as soon as a push completes. A repository that does not exist, or that belongs to another organization, returns `False`.

**Parameters**

- **repository_name** (`str`): Name of the repository, as `<org_id>/<name>`.
- **image_tag** (`str`): Tag of the image.
- **org_id** (`Optional[str]`): Organization to act in. Required when the caller belongs to more than one organization; otherwise the caller's only organization.

**Returns**

- `bool`

### ImageRepository

```python
class roboto.image_registry.image_registry.ImageRepository
```

`from roboto.image_registry import ImageRepository`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/image_registry/image_registry.py#L86-L96)

Bases: `TypedDict`

Name and URI of a repository in Roboto's private image registry.

`ImageRegistry.create_repository` returns it.

**Attributes**

- **ImageRepository.repository_name** (`str`): Name of the repository, as `<org_id>/<name>` in lowercase.
- **ImageRepository.repository_uri** (`str`): URI to push images to and pull them from, without a tag.

### RepositoryPurpose

```python
class roboto.image_registry.image_registry.RepositoryPurpose(*args, **kwds)
```

`from roboto.image_registry import RepositoryPurpose`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/image_registry/image_registry.py#L56-L63)

Bases: `enum.Enum`

Purpose of a repository in Roboto's private image registry, which Roboto records when it creates the repository.

Roboto sets and reads this value itself; no SDK method takes or returns it.

**Attributes**

- **RepositoryPurpose.Executor** = `'executor'`: Holds images that actions run in.

### RepositoryTag

```python
class roboto.image_registry.image_registry.RepositoryTag(*args, **kwds)
```

`from roboto.image_registry import RepositoryTag`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/image_registry/image_registry.py#L66-L83)

Bases: `enum.Enum`

Key of a label Roboto sets on a repository in its private image registry when it creates the repository.

These labels are not the image tags that name a repository's images. Roboto sets and reads them itself; no SDK method takes or returns them.

**Attributes**

- **RepositoryTag.CreatedBy** = `'created_by'`: Key of the label holding the ID of the user who created the repository.

- **RepositoryTag.OrgId** = `'org_id'`: Key of the label holding the ID of the organization that owns the repository.

  Roboto checks it before the credentials from `ImageRegistry.get_temporary_credentials` can reach the repository.

- **RepositoryTag.Purpose** = `'purpose'`: Key of the label holding the repository's `RepositoryPurpose` value.
