CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-google-cloud-video-live-stream

Google Cloud Video Live Stream API client library that transcodes mezzanine live signals into direct-to-consumer streaming formats, including Dynamic Adaptive Streaming over HTTP (DASH/MPEG-DASH), and HTTP Live Streaming (HLS), for multiple device platforms.

Pending
Overview
Eval results
Files

pool-management.mddocs/

Resource Pool Management

Management of resource pools that organize and control access to streaming resources across projects and regions.

Capabilities

Getting Pool Details

Retrieves detailed information about a specific resource pool including its network configuration and resource allocations.

def get_pool(
    self,
    request: Union[GetPoolRequest, dict] = None,
    *,
    name: str = None,
    retry: OptionalRetry = gapic_v1.method.DEFAULT,
    timeout: Union[float, object] = gapic_v1.method.DEFAULT,
    metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
) -> Pool:
    """
    Returns the specified pool.

    Args:
        request: The request object containing name
        name: Required. The pool name (projects/{project}/locations/{location}/pools/{pool})
        retry: Retry configuration for the request
        timeout: Request timeout in seconds
        metadata: Additional metadata for the request

    Returns:
        Pool: The pool resource
        
    Raises:
        google.api_core.exceptions.GoogleAPICallError: If the request fails
    """

Updating Pool Configuration

Updates resource pool configuration including network settings and resource allocation parameters.

def update_pool(
    self,
    request: Union[UpdatePoolRequest, dict] = None,
    *,
    pool: Pool = None,
    update_mask: field_mask_pb2.FieldMask = None,
    retry: OptionalRetry = gapic_v1.method.DEFAULT,
    timeout: Union[float, object] = gapic_v1.method.DEFAULT,
    metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
) -> operation.Operation:
    """
    Updates the specified pool.

    Args:
        request: The request object containing update_mask, pool, and request_id
        pool: Required. The pool resource with updated fields
        update_mask: Required. Field mask specifying which fields to update
        retry: Retry configuration for the request
        timeout: Request timeout in seconds
        metadata: Additional metadata for the request

    Returns:
        google.api_core.operation.Operation: Long-running operation
        
    Raises:
        google.api_core.exceptions.GoogleAPICallError: If the request fails
    """

Pool Configuration Types

Pool Resource

class Pool:
    """
    Pool resource for organizing and managing streaming resources.
    
    Attributes:
        name (str): Pool resource name
        create_time (google.protobuf.timestamp_pb2.Timestamp): Creation timestamp
        update_time (google.protobuf.timestamp_pb2.Timestamp): Last update timestamp
        labels (MutableMapping[str, str]): User-defined labels
        network_config (NetworkConfig): Network configuration for the pool
    """

Network Configuration

class NetworkConfig:
    """
    Network configuration for resource pools.
    
    Attributes:
        peered_network (str): Peered VPC network for private connectivity
    """

Request Types

class GetPoolRequest:
    """
    Request message for GetPool.
    
    Attributes:
        name (str): Required. The pool resource name
    """

class UpdatePoolRequest:
    """
    Request message for UpdatePool.
    
    Attributes:
        update_mask (google.protobuf.field_mask_pb2.FieldMask): Required. Field mask for update
        pool (Pool): Required. The pool resource with updated fields
        request_id (str): Optional. Idempotency key for request deduplication
    """

Usage Examples

Getting Pool Information

from google.cloud.video import live_stream_v1

client = live_stream_v1.LivestreamServiceClient()

# Get pool details
pool_name = "projects/my-project/locations/us-central1/pools/my-pool"

get_request = live_stream_v1.GetPoolRequest(name=pool_name)
pool = client.get_pool(request=get_request)

print(f"Pool: {pool.name}")
print(f"Created: {pool.create_time}")
print(f"Updated: {pool.update_time}")
print(f"Labels: {dict(pool.labels)}")

if pool.network_config.peered_network:
    print(f"Peered network: {pool.network_config.peered_network}")

Updating Pool Network Configuration

from google.protobuf import field_mask_pb2

# Update pool network configuration
pool_name = "projects/my-project/locations/us-central1/pools/my-pool"

updated_pool = live_stream_v1.Pool(
    name=pool_name,
    network_config=live_stream_v1.NetworkConfig(
        peered_network="projects/my-project/global/networks/livestream-vpc"
    )
)

update_mask = field_mask_pb2.FieldMask(
    paths=["network_config.peered_network"]
)

update_request = live_stream_v1.UpdatePoolRequest(
    pool=updated_pool,
    update_mask=update_mask
)

operation = client.update_pool(request=update_request)
updated_pool_result = operation.result()
print(f"Updated pool network configuration: {updated_pool_result.network_config.peered_network}")

Updating Pool Labels

# Update pool labels for organization and management
pool_name = "projects/my-project/locations/us-central1/pools/production-pool"

updated_pool = live_stream_v1.Pool(
    name=pool_name,
    labels={
        "environment": "production",
        "team": "media-engineering",
        "cost-center": "broadcasting",
        "region": "us-central1"
    }
)

update_mask = field_mask_pb2.FieldMask(
    paths=["labels"]
)

update_request = live_stream_v1.UpdatePoolRequest(
    pool=updated_pool,
    update_mask=update_mask
)

operation = client.update_pool(request=update_request)
result = operation.result()
print(f"Updated pool labels: {dict(result.labels)}")

Pool Configuration Management

# Comprehensive pool configuration update
def configure_pool(client, pool_name, vpc_network, labels=None):
    """Configure a resource pool with network and labeling."""
    
    if labels is None:
        labels = {}
    
    # Build the pool configuration
    pool_config = live_stream_v1.Pool(
        name=pool_name,
        network_config=live_stream_v1.NetworkConfig(
            peered_network=vpc_network
        ),
        labels=labels
    )
    
    # Define what fields to update
    update_paths = ["network_config.peered_network"]
    if labels:
        update_paths.append("labels")
    
    update_mask = field_mask_pb2.FieldMask(paths=update_paths)
    
    # Execute the update
    request = live_stream_v1.UpdatePoolRequest(
        pool=pool_config,
        update_mask=update_mask
    )
    
    operation = client.update_pool(request=request)
    return operation.result()

# Example usage
pool_name = "projects/my-project/locations/us-central1/pools/media-pool"
vpc_network = "projects/my-project/global/networks/media-vpc"
labels = {
    "environment": "production",
    "application": "live-streaming",
    "managed-by": "terraform"
}

updated_pool = configure_pool(client, pool_name, vpc_network, labels)
print(f"Pool configured successfully: {updated_pool.name}")

Pool Status and Monitoring

def monitor_pool_status(client, pool_name):
    """Monitor pool status and configuration."""
    
    try:
        get_request = live_stream_v1.GetPoolRequest(name=pool_name)
        pool = client.get_pool(request=get_request)
        
        # Display pool information
        print(f"Pool Status Report")
        print(f"==================")
        print(f"Name: {pool.name}")
        print(f"Created: {pool.create_time}")
        print(f"Last Updated: {pool.update_time}")
        
        # Network configuration
        if pool.network_config.peered_network:
            print(f"Peered Network: {pool.network_config.peered_network}")
        else:
            print("Peered Network: Not configured")
        
        # Labels
        if pool.labels:
            print("Labels:")
            for key, value in pool.labels.items():
                print(f"  {key}: {value}")
        else:
            print("Labels: None")
            
        return pool
        
    except Exception as e:
        print(f"Error retrieving pool status: {e}")
        return None

# Monitor pool
pool_status = monitor_pool_status(
    client, 
    "projects/my-project/locations/us-central1/pools/my-pool"
)

Pool Network Connectivity Validation

def validate_pool_network(client, pool_name, expected_network):
    """Validate pool network configuration matches expectations."""
    
    get_request = live_stream_v1.GetPoolRequest(name=pool_name)
    pool = client.get_pool(request=get_request)
    
    current_network = pool.network_config.peered_network
    
    if current_network == expected_network:
        print(f"✓ Pool network configuration is correct: {current_network}")
        return True
    else:
        print(f"✗ Pool network mismatch!")
        print(f"  Expected: {expected_network}")
        print(f"  Current:  {current_network}")
        return False

# Validate configuration
is_valid = validate_pool_network(
    client,
    "projects/my-project/locations/us-central1/pools/production-pool",
    "projects/my-project/global/networks/production-vpc"
)

Install with Tessl CLI

npx tessl i tessl/pypi-google-cloud-video-live-stream

docs

asset-dvr-management.md

channel-management.md

clip-management.md

event-management.md

index.md

input-management.md

pool-management.md

tile.json