Bundle

Functions

wrapica.bundle.add_data_to_bundle(bundle_id, data_id)

Add data to a bundle

Parameters:
Returns:

True if successful, False otherwise

Return type:

bool

Raises:

ApiException

Examples:

 1# Imports
 2from wrapica.bundle import add_project_data_to_bundle
 3from wrapica.data import convert_icav2_uri_to_data_obj
 4
 5# Set vars
 6# Use get_bundle_obj_from_bundle_name to get bundle_id if
 7# you have the bundle name and not the bundle id
 8bundle_id = "abcdef-1234"
 9data_uri = "icav2://project_id/path/to/data"
10
11# Add project data to bundle
12add_data_to_bundle(bundle_id, convert_icav2_uri_to_data_obj(data_uri).id)
wrapica.bundle.add_pipeline_to_bundle(bundle_id, pipeline_id)

Add a pipeline to a bundle.

Parameters:
Returns:

True if successful, False otherwise

Return type:

bool

Raises:

ApiException

Examples:

 1# Wrapica imports
 2from wrapica.pipeline import get_pipeline_obj_from_pipeline_id
 3from wrapica.bundle import add_pipeline_to_bundle
 4
 5# Set vars
 6pipeline_code = "my_pipeline_code"
 7bundle_name = "my_bundle_name"
 8
 9# Get pipeline id from pipeline code
10pipeline_id = get_pipeline_obj_from_pipeline_id(pipeline_code).id
11
12# Get bundle id from bundle name
13bundle_id = get_bundle_obj_from_bundle_name(bundle_name).id
14
15# Link pipeline to bundle
16add_pipeline_to_bundle(bundle_id, pipeline_id)
wrapica.bundle.add_project_data_to_bundle(bundle_id, project_id, data_id)

Add project data to a bundle

Parameters:
Returns:

True if successful, False otherwise

Return type:

bool

Raises:

ApiException

Examples:

 1# Imports
 2from wrapica.bundle import add_project_data_to_bundle
 3from wrapica.project_data import convert_icav2_uri_to_data_obj
 4
 5# Set vars
 6bundle_id = "abcdef-1234"
 7data_uri = "icav2://project_id/path/to/data"
 8
 9# Get project id and data id from data uri
10project_data_obj = convert_icav2_uri_to_data_obj(data_uri)
11
12# Add project data to bundle
13add_project_data_to_bundle(bundle_id, project_data_obj.project_id, project_data_obj.data.id)
wrapica.bundle.coerce_bundle_id_or_name_to_bundle_id(bundle_id_or_name)

Given either a bundle id or bundle name, return the bundle id

Parameters:

bundle_id_or_name (str)

Returns:

The bundle id

Return type:

str

wrapica.bundle.coerce_bundle_id_or_name_to_bundle_obj(bundle_id_or_name)

Given either a bundle id or bundle name, return the bundle object

Parameters:

bundle_id_or_name (str)

Returns:

The bundle as an object

Return type:

Bundle

wrapica.bundle.deprecate_bundle(bundle_id)

Given a bundle id, deprecate the bundle

Parameters:

bundle_id (Union[UUID, str])

Returns:

Raises:

ApiException

Examples:

1# Imports
2from wrapica.bundle import deprecate_bundle
3
4# Set vars
5bundle_id = "abcdef-1234"
6
7# Deprecate the bundle
8deprecate_bundle(bundle_id)
wrapica.bundle.filter_bundle_data_to_top_level_only(bundle_data)

Filter bundle data to top level only (no subdirectories or files underneath folders)

Parameters:

bundle_data (List[BundleData]) – List of linked bundle data items

Returns:

List of top level bundle data items

Return type:

List[BundleData]

Examples:

 1# Imports
 2from wrapica.bundle import filter_bundle_data_to_top_level_only, list_data_in_bundle
 3
 4# Set vars
 5bundle_id = "abcdef-1234"
 6
 7# Get all data
 8bundle_data = list_data_in_bundle(bundle_id)
 9
10# Filter to top level only
11top_level_bundle_data = filter_bundle_data_to_top_level_only(bundle_data)
wrapica.bundle.filter_bundles(bundle_name=None, project_id=None, region_id=None, status=None, creator_id=None)

Get a list of bundles but filter by name, region id, status, and creator id

Parameters:
  • bundle_name (Optional[str]) – The name of the bundle

  • project_id (Union[UUID, str, None]) – The project id

  • region_id (Union[UUID, str, None]) – The region id of the bundle

  • status (Optional[Literal['DRAFT', 'RELEASED', 'DEPRECATED']]) – The status of the bundle

  • creator_id (Union[UUID, str, None]) – The creator id of the bundle

Returns:

List of bundles

Return type:

List[Bundle]

Raises:

ApiException

Examples:

 1# Imports
 2from wrapica.bundle import filter_bundles
 3from wrapica.libica_models import Bundle
 4from wrapica.enums import BundleStatus
 5from wrapica.user import get_user_from_user_name
 6
 7# Set vars
 8user_name = "Alexis Lucattini"
 9
10# Get creator id from user name
11creator_id = get_user_from_user_name(user_name).id
12
13# Filter bundles
14bundle_list: List[Bundle] = filter_bundles(
15    bundle_status=BundleStatus.RELEASED,
16    creator_id=creator_id
17)
wrapica.bundle.generate_empty_bundle(bundle_name, bundle_version, short_description, version_comment, region_id=None, categories=None, pipeline_release_url=None)

Generate an empty bundle (in DRAFT format) and return the bundle object

Parameters:
  • bundle_name (str) – The name of the bundle

  • bundle_version (str) – The version of the bundle

  • short_description (str) – The description of the bundle

  • version_comment (str) – The description of the version

  • region_id (Union[UUID, str, None]) – The region id of the bundle

  • categories (Optional[List[str]])

  • pipeline_release_url (Optional[str])

Returns:

The newly created bundle object

Return type:

Bundle

Raises:

ApiException

Examples:

:linenos:

from wrapica.bundle import generate_empty_bundle
from wrapica.libica_models import Bundle

# Initialise bundle
bundle_obj: Bundle = generate_empty_bundle(
    bundle_name="my-first-bundle",
    bundle_description="A quick description of the bundle",
    bundle_version="1.0.0",
    bundle_version_description="First release of my-first-bundle",
    categories=["Test"]
)
wrapica.bundle.get_bundle_obj_from_bundle_id(bundle_id)

Given a bundle_id, return the bundle object

Parameters:

bundle_id (Union[UUID, str])

Returns:

The bundle as an object

Return type:

Bundle

Raises:

ApiException

Examples:

1from wrapica.bundle import get_bundle_obj_from_bundle_id
2from wrapica.libica_models import Bundle
3
4# Get bundle object from the bundle id
5bundle_obj: Bundle = get_bundle_obj_from_bundle_id(
6    bundle_id='abcdef-1234'
7)
wrapica.bundle.get_bundle_obj_from_bundle_name(bundle_name, region_id=None)

Given a bundle name, return the bundle object

Parameters:
  • bundle_name (str) – The bundle name

  • region_id (Union[UUID, str, None]) – The region id of the bundle

Returns:

The bundle as an object

Return type:

Bundle

Raises:

ApiException

Examples:

1from wrapica.bundle import get_bundle_obj_from_bundle_name
2from wrapica.libica_models import Bundle
3
4# Get bundle object from the bundle name
5bundle_obj: Bundle = get_bundle_obj_from_bundle_name(
6    bundle_name='my-first-bundle'
7)

Link bundle to project

Parameters:
  • project_id (Union[UUID, str]) – The project id

  • bundle_id (Union[UUID, str]) – The bundle id

Raises:

ApiException

Examples:

1# Imports
2from wrapica.bundle import link_bundle_to_project
3
4# Set vars
5project_id = "abcdef-1234"
6bundle_id = "abcdef-1234"
7
8# Link bundle to project
9link_bundle_to_project(project_id, bundle_id)
wrapica.bundle.list_bundles_in_project(project_id)

List bundles in a project

Parameters:

project_id (Union[UUID, str]) – The project id

Returns:

List of bundles linked to this project

Return type:

List[Bundle]

Raises:

ApiException

Examples:

1# Imports
2from wrapica.bundle import list_bundles_in_project
3
4list_bundles_in_project(project_id='abcdef-1234')    
wrapica.bundle.list_data_in_bundle(bundle_id)

Given a bundle id, list data in a bundle

Parameters:

bundle_id (Union[UUID, str])

Returns:

List of data items

Return type:

List[BundleData]

Raises:

ApiException

Examples:

1# Imports
2from wrapica.bundle import list_data_in_bundles
3
4list_data_in_bundle(bundle_id='abcdef-1234')
wrapica.bundle.list_pipelines_in_bundle(bundle_id)

Given a bundle id, list pipelines in a bundle

Parameters:

bundle_id (Union[UUID, str]) – The bundle id

Returns:

List of pipeline items

Return type:

List[BundlePipeline]

Raises:

ApiException

Examples:

1# Imports
2from wrapica.bundle import list_pipelines_in_bundle
3
4list_pipelines_in_bundle(bundle_id='abcdef-1234')
wrapica.bundle.release_bundle(bundle_id)

Release a bundle, converts a bundle status from DRAFT to RELEASED.

Parameters:

bundle_id (Union[UUID, str])

Raises:

ApiException

Examples:

1# Imports
2from wrapica.bundle import release_bundle
3
4# Set vars
5bundle_id = "abcdef-1234"
6
7# Release bundle
8release_bundle(bundle_id)

Remove the bundle from the project

Parameters:
  • project_id (Union[UUID, str]) – The project id

  • bundle_id (Union[UUID, str]) – The bundle id

Raises:

ApiException

Examples:

1# Imports
2from wrapica.bundle import unlink_bundle_from_project
3
4# Set vars
5project_id = "abcdef-1234"
6bundle_id = "abcdef-1234"
7
8# Unlink bundle to project
9unlink_bundle_from_project(project_id, bundle_id)