Microsoft Azure App Configuration Management Client Library for Python
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
The Operations class provides utility operations for the Azure App Configuration service, including name availability checks and listing all available API operations.
class Operations:
"""
General operations for Azure App Configuration service.
This class provides utility methods for checking resource name availability
and discovering available API operations for the service.
"""Checks whether a configuration store name is available for use globally across Azure.
def check_name_availability(
self,
check_name_availability_parameters: CheckNameAvailabilityParameters,
**kwargs: Any
) -> NameAvailabilityStatus:
"""
Checks whether the configuration store name is available for use.
Args:
check_name_availability_parameters: Parameters for checking name availability
**kwargs: Additional keyword arguments for the request
Returns:
NameAvailabilityStatus: The availability status and reason if unavailable
Example:
>>> from azure.mgmt.appconfiguration.models import CheckNameAvailabilityParameters
>>> params = CheckNameAvailabilityParameters(
... name="my-config-store",
... type="Microsoft.AppConfiguration/configurationStores"
... )
>>> result = client.operations.check_name_availability(params)
>>> print(f"Available: {result.name_available}")
>>> if not result.name_available:
... print(f"Reason: {result.reason} - {result.message}")
"""Checks whether a configuration store name is available for use within a specific Azure region.
def regional_check_name_availability(
self,
location: str,
check_name_availability_parameters: CheckNameAvailabilityParameters,
**kwargs: Any
) -> NameAvailabilityStatus:
"""
Checks whether the configuration store name is available for use in a specific region.
Args:
location: The Azure region to check availability in
check_name_availability_parameters: Parameters for checking name availability
**kwargs: Additional keyword arguments for the request
Returns:
NameAvailabilityStatus: The availability status and reason if unavailable
Example:
>>> from azure.mgmt.appconfiguration.models import CheckNameAvailabilityParameters
>>> params = CheckNameAvailabilityParameters(
... name="my-regional-store",
... type="Microsoft.AppConfiguration/configurationStores"
... )
>>> result = client.operations.regional_check_name_availability(
... location="East US",
... check_name_availability_parameters=params
... )
>>> print(f"Available in East US: {result.name_available}")
"""Lists all available operations for the Azure App Configuration resource provider.
def list(
self,
skip_token: Optional[str] = None,
**kwargs: Any
) -> ItemPaged[OperationDefinition]:
"""
Lists the operations available from this provider.
Args:
skip_token: A skip token to retrieve the next set of results, if any
**kwargs: Additional keyword arguments for the request
Returns:
ItemPaged[OperationDefinition]: A paged collection of operation definitions
Example:
>>> operations = client.operations.list()
>>> for operation in operations:
... print(f"Operation: {operation.name}")
... print(f"Display name: {operation.display.operation}")
... print(f"Description: {operation.display.description}")
"""from azure.mgmt.appconfiguration import AppConfigurationManagementClient
from azure.mgmt.appconfiguration.models import CheckNameAvailabilityParameters
from azure.identity import DefaultAzureCredential
# Initialize client
credential = DefaultAzureCredential()
client = AppConfigurationManagementClient(credential, "your-subscription-id")
# Check if a store name is available globally
params = CheckNameAvailabilityParameters(
name="my-unique-config-store",
type="Microsoft.AppConfiguration/configurationStores"
)
availability = client.operations.check_name_availability(params)
if availability.name_available:
print("Name is available - you can create the store")
else:
print(f"Name not available: {availability.reason}")
print(f"Message: {availability.message}")# Check if a store name is available in a specific region
regional_availability = client.operations.regional_check_name_availability(
location="West US 2",
check_name_availability_parameters=params
)
if regional_availability.name_available:
print("Name is available in West US 2")
else:
print(f"Name not available in West US 2: {regional_availability.reason}")# List all available operations for the service
print("Available Azure App Configuration operations:")
operations = client.operations.list()
for operation in operations:
print(f"\nOperation: {operation.name}")
if operation.display:
print(f" Provider: {operation.display.provider}")
print(f" Resource: {operation.display.resource}")
print(f" Operation: {operation.display.operation}")
print(f" Description: {operation.display.description}")
if operation.properties and operation.properties.service_specification:
print(f" Service specification available: Yes")class CheckNameAvailabilityParameters:
"""
Parameters for checking name availability.
Attributes:
name: The name to check for availability
type: The resource type (always "Microsoft.AppConfiguration/configurationStores")
"""
def __init__(
self,
*,
name: str,
type: str = "Microsoft.AppConfiguration/configurationStores"
) -> None: ...class NameAvailabilityStatus:
"""
Result of a name availability check.
Attributes:
name_available: Whether the name is available
reason: Reason why the name is not available (if applicable)
message: Detailed message about availability status
"""
name_available: Optional[bool]
reason: Optional[str]
message: Optional[str]class OperationDefinition:
"""
Definition of an available operation.
Attributes:
name: Operation name
display: Display information for the operation
properties: Additional properties and specifications
"""
name: Optional[str]
display: Optional[OperationDefinitionDisplay]
properties: Optional[OperationProperties]class OperationDefinitionDisplay:
"""
Display information for an operation.
Attributes:
provider: The resource provider name
resource: The resource type
operation: The operation name for display
description: Description of the operation
"""
provider: Optional[str]
resource: Optional[str]
operation: Optional[str]
description: Optional[str]Name availability operations can fail with various errors:
from azure.core.exceptions import HttpResponseError
try:
availability = client.operations.check_name_availability(params)
except HttpResponseError as e:
print(f"Error checking name availability: {e.status_code}")
print(f"Error message: {e.message}")Install with Tessl CLI
npx tessl i tessl/pypi-azure-mgmt-appconfiguration