CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-azure-mgmt-media

Microsoft Azure Media Services Client Library for Python - A management library for Azure Media Services that provides programmatic access to media processing and streaming capabilities in the cloud.

83

1.09x

Quality

Pending

Does it follow best practices?

Impact

83%

1.09x

Average score across 10 eval scenarios

Overview
Eval results
Files

task.mdevals/scenario-2/

Media Asset Lifecycle Manager

Build a media asset lifecycle management system that creates, configures, and manages media assets in Azure Media Services.

Requirements

Your system must implement the following capabilities:

Asset Creation and Configuration

Create a new media asset with proper configuration:

  • Accept an asset name and optional description
  • Configure the asset with an alternate ID for external reference tracking
  • Associate the asset with a specific storage account container
  • Return the created asset object with its resource ID

Asset Upload URL Generation

Generate secure upload URLs for media files:

  • Create a SAS (Shared Access Signature) URL with write permissions
  • Set appropriate expiry time for the upload token (minimum 1 hour)
  • Return both the container path and the SAS token URL
  • Handle cases where the asset doesn't exist

Asset Listing and Filtering

Retrieve and filter assets from the Media Services account:

  • List all assets in the account
  • Support filtering by creation date range
  • Support ordering results by creation date (ascending or descending)
  • Return a collection of asset objects with their metadata

Asset Retrieval

Get detailed information about a specific asset:

  • Retrieve an asset by its name
  • Return the asset's properties including resource ID, storage account, alternate ID, and description
  • Handle cases where the asset doesn't exist

Implementation Notes

  • All operations should work with an authenticated Azure Media Services client
  • Use proper error handling for resource not found scenarios
  • Asset names must be unique within a Media Services account
  • Container names are automatically generated based on the asset name

Test Cases

  • Creating a new asset with name "video-asset-001" and description "Product demo video" returns an asset object with the specified properties @test
  • Generating upload URL for an existing asset returns a valid SAS URL with write permissions @test
  • Listing all assets returns a collection of asset objects @test
  • Retrieving an existing asset by name returns the asset with all its properties @test

@generates

API

from typing import Optional, List, Dict, Any
from datetime import datetime

class MediaAssetManager:
    """
    Manages media asset lifecycle operations in Azure Media Services.
    """

    def __init__(self, client, resource_group: str, account_name: str):
        """
        Initialize the asset manager.

        Args:
            client: Azure Media Services client instance
            resource_group: Azure resource group name
            account_name: Media Services account name
        """
        pass

    def create_asset(
        self,
        asset_name: str,
        description: Optional[str] = None,
        alternate_id: Optional[str] = None,
        storage_account_name: Optional[str] = None
    ) -> Any:
        """
        Create a new media asset.

        Args:
            asset_name: Unique name for the asset
            description: Optional description of the asset
            alternate_id: Optional alternate ID for external reference
            storage_account_name: Optional storage account name

        Returns:
            The created asset object
        """
        pass

    def get_upload_url(self, asset_name: str, expiry_hours: int = 1) -> Dict[str, str]:
        """
        Generate a SAS URL for uploading content to an asset.

        Args:
            asset_name: Name of the asset
            expiry_hours: Hours until the SAS token expires (default: 1)

        Returns:
            Dictionary containing 'container' and 'sas_url' keys
        """
        pass

    def list_assets(
        self,
        order_by: Optional[str] = None,
        filter_query: Optional[str] = None
    ) -> List[Any]:
        """
        List assets with optional filtering and ordering.

        Args:
            order_by: Optional ordering (e.g., "properties/created asc")
            filter_query: Optional OData filter query

        Returns:
            List of asset objects
        """
        pass

    def get_asset(self, asset_name: str) -> Any:
        """
        Retrieve a specific asset by name.

        Args:
            asset_name: Name of the asset to retrieve

        Returns:
            The asset object if found
        """
        pass

Dependencies { .dependencies }

azure-mgmt-media { .dependency }

Provides Azure Media Services management capabilities for creating and managing media assets.

Install with Tessl CLI

npx tessl i tessl/pypi-azure-mgmt-media

tile.json