connect.bundles
connect.bundles
Bundle resources.
Classes
| Name | Description |
|---|---|
| Bundle | |
| BundleMetadata | |
| Bundles | Bundles resource. |
Bundle
connect.bundles.Bundle(self, ctx, /, **kwargs)Attributes
| Name | Description |
|---|---|
| metadata |
Methods
| Name | Description |
|---|---|
| delete | Delete the bundle. |
| deploy | Deploy the bundle. |
| download | Download a bundle. |
delete
connect.bundles.Bundle.delete()Delete the bundle.
deploy
connect.bundles.Bundle.deploy()Deploy the bundle.
Spawns an asynchronous task, which activates the bundle.
Returns
| Name | Type | Description |
|---|---|---|
| tasks.Task | The task for the deployment. |
Examples
>>> task = bundle.deploy()
>>> task.wait_for()
Nonedownload
connect.bundles.Bundle.download(output)Download a bundle.
Download a bundle to a file or memory.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| output | io.BufferedWriter or str | An io.BufferedWriter instance or a str representing a relative or absolute path. | required |
Raises
| Name | Type | Description |
|---|---|---|
| TypeError | If the output is not of type io.BufferedWriter or str. |
Examples
Write to a file.
>>> bundle.download("bundle.tar.gz")
NoneWrite to an io.BufferedWriter.
>>> with open('bundle.tar.gz', 'wb') as file:
>>> bundle.download(file)
NoneBundleMetadata
connect.bundles.BundleMetadata(self, ctx, /, **kwargs)Bundles
connect.bundles.Bundles(self, ctx, content_guid)Bundles resource.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| config | config.Config |
Configuration object. | required |
| session | requests.Session | HTTP session object. | required |
| content_guid | str | Content GUID associated with the bundles. | required |
Attributes
| Name | Type | Description |
|---|---|---|
| content_guid | str | Content GUID associated with the bundles. |
Methods
| Name | Description |
|---|---|
| active | Retrieve the active bundle. |
| create | Create a bundle. |
| find | Find all bundles. |
| find_one | Find a bundle. |
| get | Get a bundle. |
active
connect.bundles.Bundles.active()Retrieve the active bundle.
Returns
| Name | Type | Description |
|---|---|---|
| Bundle | None | The currently active bundle, or None if no active bundle exists. |
Examples
>>> client = connect.Client()
>>> content = client.content.get(guid)
>>> bundle = content.bundles.active()create
connect.bundles.Bundles.create(archive)Create a bundle.
Create a bundle from a file or memory.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| archive | io.BufferedReader, bytes, or str | Archive for bundle creation. A ‘str’ type assumes a relative or absolute filepath. | required |
Returns
| Name | Type | Description |
|---|---|---|
| Bundle | The created bundle. |
Raises
| Name | Type | Description |
|---|---|---|
| TypeError | If the input is not of type io.BufferedReader, bytes, or str. |
Examples
Create a bundle from io.BufferedReader
>>> with open('bundle.tar.gz', 'rb') as file:
>>> bundle.create(file)
NoneCreate a bundle from bytes.
>>> with open('bundle.tar.gz', 'rb') as file:
>>> data: bytes = file.read()
>>> bundle.create(data)
NoneCreate a bundle from pathname.
>>> bundle.create("bundle.tar.gz")
Nonefind
connect.bundles.Bundles.find()Find all bundles.
Returns
| Name | Type | Description |
|---|---|---|
| list of Bundle | List of all found bundles. |
find_one
connect.bundles.Bundles.find_one()Find a bundle.
Returns
| Name | Type | Description |
|---|---|---|
| Bundle | None | The first found bundle | None if no bundles are found. |
get
connect.bundles.Bundles.get(uid)Get a bundle.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| uid | str | Identifier of the bundle to retrieve. | required |
Returns
| Name | Type | Description |
|---|---|---|
| Bundle | The bundle with the specified ID. |