Manage asset status

How to manage asset status

Read time 3 minutes

Before you start

To access any assets, make sure the app has the right permissions. Read more about managing Identity.

Get the reachable status of an asset

The status that an asset can reach depends on its current status and the assigned status flow. To list the reachable status of an asset, call the get_asset_reachable_statuses method.

    reachable_status = unity_cloud.assets.get_asset_reachable_statuses(
        org_id = "012345678912",
        project_id = "1234abcd-ab12-cd34-ef56-123456abcdef",
        asset_id = "0123456789abcdefghijklmn",
        asset_version = '1234abcd-ab12-cd34-ef56-123456abcdef'
    )

Update asset status

Using the result of get_asset_reachable_statuses, you can update the status of an asset. To do so, call the update_asset_status method.

    unity_cloud.assets.update_asset_status(
        org_id = "012345678912",
        project_id = "1234abcd-ab12-cd34-ef56-123456abcdef",
        asset_id = "0123456789abcdefghijklmn",
        asset_version = '1234abcd-ab12-cd34-ef56-123456abcdef',
        status = "status"
    )

Get a status flow

To get the status flow of an asset, call the get_asset_status_flow method. With this feature, you can explore the whole state machine of statuses an asset can reach and the transitions between them.

    status_flow = unity_cloud.assets.get_asset_status_flow(
        org_id = "012345678912",
        project_id = "1234abcd-ab12-cd34-ef56-123456abcdef",
        asset_id = "0123456789abcdefghijklmn",
        asset_version = '1234abcd-ab12-cd34-ef56-123456abcdef'
    )

List all status flows

To list all status flows of an organization, call the list_status_flow method.

    status_flows = unity_cloud.assets.list_status_flow(
        org_id = "012345678912"
    )

Change the status flow assigned to an asset

To change the status flow assigned to an asset, call the update_asset_status_flow method.

    unity_cloud.assets.update_asset_status_flow(
        org_id = "012345678912",
        project_id = "1234abcd-ab12-cd34-ef56-123456abcdef",
        asset_id = "0123456789abcdefghijklmn",
        asset_version = '1234abcd-ab12-cd34-ef56-123456abcdef',
        status_flow_id = "1234abcd-ab12-cd34-ef56-123456abcdef"
    )