CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-azure-mgmt-computeschedule

Microsoft Azure ComputeSchedule Management Client Library for Python providing VM scheduling operations.

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

client-setup.mddocs/

Client Setup and Configuration

Initialize and configure the Azure ComputeSchedule management client with proper authentication, subscription targeting, and optional custom settings.

Capabilities

Synchronous Client Initialization

Create a synchronous ComputeSchedule management client for standard operations.

class ComputeScheduleMgmtClient:
    def __init__(
        self, 
        credential: TokenCredential, 
        subscription_id: str, 
        base_url: Optional[str] = None, 
        **kwargs: Any
    ) -> None:
        """
        Initialize ComputeSchedule management client.
        
        Parameters:
        - credential: TokenCredential for authentication (required)
        - subscription_id: Azure subscription ID in UUID format (required)  
        - base_url: Custom service host URL (optional)
        - api_version: API version override (keyword-only, default: "2025-05-01")
        """

Usage Example:

from azure.mgmt.computeschedule import ComputeScheduleMgmtClient
from azure.identity import DefaultAzureCredential
import os

# Standard initialization with default Azure credentials
credential = DefaultAzureCredential()
subscription_id = os.getenv("AZURE_SUBSCRIPTION_ID")
client = ComputeScheduleMgmtClient(credential, subscription_id)

# Custom configuration with specific API version
client = ComputeScheduleMgmtClient(
    credential=credential,
    subscription_id=subscription_id,
    api_version="2025-05-01"
)

Asynchronous Client Initialization

Create an asynchronous ComputeSchedule management client for async/await operations.

# From azure.mgmt.computeschedule.aio
class ComputeScheduleMgmtClient:
    def __init__(
        self, 
        credential: AsyncTokenCredential, 
        subscription_id: str, 
        base_url: Optional[str] = None, 
        **kwargs: Any
    ) -> None:
        """
        Initialize async ComputeSchedule management client.
        
        Same parameters as synchronous client but supports async operations.
        """

Usage Example:

from azure.mgmt.computeschedule.aio import ComputeScheduleMgmtClient
from azure.identity.aio import DefaultAzureCredential
import asyncio

async def main():
    credential = DefaultAzureCredential()
    subscription_id = "your-subscription-id"
    
    async with ComputeScheduleMgmtClient(credential, subscription_id) as client:
        # Use client for async operations
        operations = await client.operations.list()
        async for operation in operations:
            print(f"Operation: {operation.name}")

asyncio.run(main())

Client Properties and Methods

Access operation interfaces and utility methods through the initialized client.

class ComputeScheduleMgmtClient:
    @property
    def operations(self) -> Operations:
        """General operations interface for provider operations."""
    
    @property  
    def scheduled_actions(self) -> ScheduledActionsOperations:
        """VM scheduling operations interface."""
    
    def send_request(
        self, 
        request: HttpRequest, 
        *, 
        stream: bool = False, 
        **kwargs: Any
    ) -> HttpResponse:
        """
        Send custom HTTP request through client pipeline.
        
        Parameters:
        - request: HTTP request to send (required)
        - stream: Whether to stream response payload (keyword-only, default: False)
        
        Returns:
        HTTP response without error handling
        """
    
    def close(self) -> None:
        """Close client connections and cleanup resources."""
    
    def __enter__(self) -> Self:
        """Context manager entry."""
    
    def __exit__(self, *exc_details: Any) -> None:
        """Context manager exit with cleanup."""

Authentication Configuration

Set up Azure Active Directory authentication using environment variables or credential objects.

Environment Variables:

export AZURE_CLIENT_ID="your-client-id"
export AZURE_TENANT_ID="your-tenant-id" 
export AZURE_CLIENT_SECRET="your-client-secret"
export AZURE_SUBSCRIPTION_ID="your-subscription-id"

Authentication Examples:

from azure.identity import (
    DefaultAzureCredential,
    ClientSecretCredential,
    ManagedIdentityCredential
)

# Default credential chain (recommended)
credential = DefaultAzureCredential()

# Specific service principal
credential = ClientSecretCredential(
    tenant_id="your-tenant-id",
    client_id="your-client-id", 
    client_secret="your-client-secret"
)

# Managed identity (for Azure resources)
credential = ManagedIdentityCredential()

# Initialize client with chosen credential
client = ComputeScheduleMgmtClient(credential, subscription_id)

Context Manager Usage

Use the client as a context manager for automatic resource cleanup.

from azure.mgmt.computeschedule import ComputeScheduleMgmtClient
from azure.identity import DefaultAzureCredential

subscription_id = "your-subscription-id"
credential = DefaultAzureCredential()

# Automatic cleanup with context manager
with ComputeScheduleMgmtClient(credential, subscription_id) as client:
    # Client operations
    response = client.scheduled_actions.virtual_machines_submit_deallocate(
        locationparameter="eastus",
        request_body=request
    )
    print(f"Operation ID: {response.operation_id}")
# Client automatically closed here

Install with Tessl CLI

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

docs

client-setup.md

immediate-operations.md

index.md

models-types.md

operation-management.md

scheduled-operations.md

tile.json