Azure Data Migration Client Library for programmatically managing database migration services and operations.
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Operations for managing Azure Data Migration Service instances, including creation, configuration, lifecycle management, and monitoring. These operations handle the fundamental service resources that host migration projects and tasks.
Creates a new Data Migration Service or updates an existing one. This is a long-running operation that provisions Azure resources.
def begin_create_or_update(
group_name: str,
service_name: str,
parameters: DataMigrationService,
**kwargs
) -> LROPoller[DataMigrationService]:
"""
Creates or updates a Data Migration Service instance.
Parameters:
- group_name: Name of the resource group
- service_name: Name of the service
- parameters: Service configuration and properties
Returns:
LROPoller for the long-running operation
"""Usage Example:
from azure.mgmt.datamigration.models import DataMigrationService, ServiceSku
service_params = DataMigrationService(
location="eastus",
kind="vm",
sku=ServiceSku(
name="Standard_1vCore",
tier="Standard",
size="1 vCore"
),
virtual_subnet_id="/subscriptions/.../virtualNetworks/myVNet/subnets/default"
)
# Start the creation (long-running operation)
poller = client.services.begin_create_or_update(
group_name="myResourceGroup",
service_name="myMigrationService",
parameters=service_params
)
# Wait for completion
service = poller.result()
print(f"Service {service.name} created successfully")Retrieves details of an existing Data Migration Service.
def get(group_name: str, service_name: str, **kwargs) -> DataMigrationService:
"""
Gets a Data Migration Service resource.
Parameters:
- group_name: Name of the resource group
- service_name: Name of the service
Returns:
DataMigrationService object with current state and properties
"""Deletes an Data Migration Service instance and all associated resources.
def begin_delete(group_name: str, service_name: str, **kwargs) -> LROPoller[None]:
"""
Deletes a Data Migration Service instance.
Parameters:
- group_name: Name of the resource group
- service_name: Name of the service
Returns:
LROPoller for the deletion operation
"""Updates properties of an existing Data Migration Service.
def begin_update(
group_name: str,
service_name: str,
parameters: DataMigrationService,
**kwargs
) -> LROPoller[DataMigrationService]:
"""
Updates a Data Migration Service instance.
Parameters:
- group_name: Name of the resource group
- service_name: Name of the service
- parameters: Updated service properties
Returns:
LROPoller for the update operation
"""Starts a Data Migration Service that is currently stopped.
def begin_start(group_name: str, service_name: str, **kwargs) -> LROPoller[None]:
"""
Starts a Data Migration Service.
Parameters:
- group_name: Name of the resource group
- service_name: Name of the service
Returns:
LROPoller for the start operation
"""Stops a running Data Migration Service to reduce costs.
def begin_stop(group_name: str, service_name: str, **kwargs) -> LROPoller[None]:
"""
Stops a Data Migration Service.
Parameters:
- group_name: Name of the resource group
- service_name: Name of the service
Returns:
LROPoller for the stop operation
"""Gets the current operational status of a Data Migration Service.
def check_status(group_name: str, service_name: str, **kwargs) -> DataMigrationServiceStatusResponse:
"""
Gets the status of a Data Migration Service.
Parameters:
- group_name: Name of the resource group
- service_name: Name of the service
Returns:
Service status information including operational state
"""Lists Data Migration Services in the subscription or resource group.
def list(**kwargs) -> ItemPaged[DataMigrationService]:
"""
Lists all Data Migration Services in the subscription.
Returns:
Paged collection of DataMigrationService objects
"""
def list_by_resource_group(group_name: str, **kwargs) -> ItemPaged[DataMigrationService]:
"""
Lists Data Migration Services in a resource group.
Parameters:
- group_name: Name of the resource group
Returns:
Paged collection of DataMigrationService objects
"""Gets available service SKUs for Data Migration Services.
def list_skus(group_name: str, service_name: str, **kwargs) -> ItemPaged[AvailableServiceSku]:
"""
Lists available SKUs for a Data Migration Service.
Parameters:
- group_name: Name of the resource group
- service_name: Name of the service
Returns:
Available SKU options with capacity and cost information
"""Checks if a service name is available for use.
def check_name_availability(
location: str,
parameters: NameAvailabilityRequest,
**kwargs
) -> NameAvailabilityResponse:
"""
Checks name availability for a Data Migration Service.
Parameters:
- location: Azure region
- parameters: Name availability request with desired name
Returns:
Name availability response indicating if name is available
"""
def check_children_name_availability(
group_name: str,
service_name: str,
parameters: NameAvailabilityRequest,
**kwargs
) -> NameAvailabilityResponse:
"""
Checks name availability for child resources (projects, tasks).
Parameters:
- group_name: Name of the resource group
- service_name: Name of the service
- parameters: Name availability request
Returns:
Name availability response for child resource names
"""class DataMigrationService:
"""Azure Data Migration Service resource definition."""
def __init__(self, location: str, **kwargs):
"""
Initialize Data Migration Service.
Parameters:
- location: Azure region where service will be created
- kind: Service kind (typically "vm")
- sku: Service SKU configuration
- virtual_subnet_id: Virtual network subnet ID
- public_key: Public key for service authentication
"""
# Properties
location: str # Required: Azure region
kind: str # Service kind (e.g., "vm")
sku: ServiceSku # Service tier and capacity
provisioning_state: str # Current provisioning state
public_key: str # Public key for authentication
virtual_subnet_id: str # Virtual network subnet
etag: str # Entity tag for concurrency control
id: str # Resource ID
name: str # Resource name
type: str # Resource type
tags: Dict[str, str] # Resource tagsclass ServiceSku:
"""Service SKU configuration."""
def __init__(self, **kwargs):
"""Initialize service SKU."""
# Properties
name: str # SKU name (e.g., "Standard_1vCore")
tier: str # SKU tier (e.g., "Standard")
size: str # SKU size description
family: str # SKU family
capacity: int # SKU capacityclass DataMigrationServiceStatusResponse:
"""Service status response."""
# Properties
agent_version: str # Version of the service agent
status: str # Current operational status
vm_size: str # Virtual machine size
supported_task_types: List[str] # Supported migration task types
class NameAvailabilityRequest:
"""Name availability check request."""
def __init__(self, name: str, type: str, **kwargs):
"""
Parameters:
- name: Desired resource name
- type: Resource type to check
"""
# Properties
name: str # Name to check
type: str # Resource type
class NameAvailabilityResponse:
"""Name availability check response."""
# Properties
name_available: bool # Whether name is available
reason: str # Reason if unavailable
message: str # Detailed messageService operations may raise these common exceptions:
ResourceExistsError: Service name already existsResourceNotFoundError: Service or resource group not foundClientAuthenticationError: Authentication failedHttpResponseError: Other HTTP errors with detailed error informationAlways handle long-running operations properly by checking the poller status and handling potential failures during provisioning operations.
Install with Tessl CLI
npx tessl i tessl/pypi-azure-mgmt-datamigration