0
# General Operations
1
2
The `Operations` class provides utility operations for the Azure App Configuration service, including name availability checks and listing all available API operations.
3
4
## Operations Class
5
6
```python { .api }
7
class Operations:
8
"""
9
General operations for Azure App Configuration service.
10
11
This class provides utility methods for checking resource name availability
12
and discovering available API operations for the service.
13
"""
14
```
15
16
## Capabilities
17
18
### Check Name Availability
19
20
Checks whether a configuration store name is available for use globally across Azure.
21
22
```python { .api }
23
def check_name_availability(
24
self,
25
check_name_availability_parameters: CheckNameAvailabilityParameters,
26
**kwargs: Any
27
) -> NameAvailabilityStatus:
28
"""
29
Checks whether the configuration store name is available for use.
30
31
Args:
32
check_name_availability_parameters: Parameters for checking name availability
33
**kwargs: Additional keyword arguments for the request
34
35
Returns:
36
NameAvailabilityStatus: The availability status and reason if unavailable
37
38
Example:
39
>>> from azure.mgmt.appconfiguration.models import CheckNameAvailabilityParameters
40
>>> params = CheckNameAvailabilityParameters(
41
... name="my-config-store",
42
... type="Microsoft.AppConfiguration/configurationStores"
43
... )
44
>>> result = client.operations.check_name_availability(params)
45
>>> print(f"Available: {result.name_available}")
46
>>> if not result.name_available:
47
... print(f"Reason: {result.reason} - {result.message}")
48
"""
49
```
50
51
### Regional Check Name Availability
52
53
Checks whether a configuration store name is available for use within a specific Azure region.
54
55
```python { .api }
56
def regional_check_name_availability(
57
self,
58
location: str,
59
check_name_availability_parameters: CheckNameAvailabilityParameters,
60
**kwargs: Any
61
) -> NameAvailabilityStatus:
62
"""
63
Checks whether the configuration store name is available for use in a specific region.
64
65
Args:
66
location: The Azure region to check availability in
67
check_name_availability_parameters: Parameters for checking name availability
68
**kwargs: Additional keyword arguments for the request
69
70
Returns:
71
NameAvailabilityStatus: The availability status and reason if unavailable
72
73
Example:
74
>>> from azure.mgmt.appconfiguration.models import CheckNameAvailabilityParameters
75
>>> params = CheckNameAvailabilityParameters(
76
... name="my-regional-store",
77
... type="Microsoft.AppConfiguration/configurationStores"
78
... )
79
>>> result = client.operations.regional_check_name_availability(
80
... location="East US",
81
... check_name_availability_parameters=params
82
... )
83
>>> print(f"Available in East US: {result.name_available}")
84
"""
85
```
86
87
### List Operations
88
89
Lists all available operations for the Azure App Configuration resource provider.
90
91
```python { .api }
92
def list(
93
self,
94
skip_token: Optional[str] = None,
95
**kwargs: Any
96
) -> ItemPaged[OperationDefinition]:
97
"""
98
Lists the operations available from this provider.
99
100
Args:
101
skip_token: A skip token to retrieve the next set of results, if any
102
**kwargs: Additional keyword arguments for the request
103
104
Returns:
105
ItemPaged[OperationDefinition]: A paged collection of operation definitions
106
107
Example:
108
>>> operations = client.operations.list()
109
>>> for operation in operations:
110
... print(f"Operation: {operation.name}")
111
... print(f"Display name: {operation.display.operation}")
112
... print(f"Description: {operation.display.description}")
113
"""
114
```
115
116
## Usage Examples
117
118
### Check Store Name Availability
119
120
```python
121
from azure.mgmt.appconfiguration import AppConfigurationManagementClient
122
from azure.mgmt.appconfiguration.models import CheckNameAvailabilityParameters
123
from azure.identity import DefaultAzureCredential
124
125
# Initialize client
126
credential = DefaultAzureCredential()
127
client = AppConfigurationManagementClient(credential, "your-subscription-id")
128
129
# Check if a store name is available globally
130
params = CheckNameAvailabilityParameters(
131
name="my-unique-config-store",
132
type="Microsoft.AppConfiguration/configurationStores"
133
)
134
135
availability = client.operations.check_name_availability(params)
136
if availability.name_available:
137
print("Name is available - you can create the store")
138
else:
139
print(f"Name not available: {availability.reason}")
140
print(f"Message: {availability.message}")
141
```
142
143
### Check Regional Name Availability
144
145
```python
146
# Check if a store name is available in a specific region
147
regional_availability = client.operations.regional_check_name_availability(
148
location="West US 2",
149
check_name_availability_parameters=params
150
)
151
152
if regional_availability.name_available:
153
print("Name is available in West US 2")
154
else:
155
print(f"Name not available in West US 2: {regional_availability.reason}")
156
```
157
158
### Discover Available Operations
159
160
```python
161
# List all available operations for the service
162
print("Available Azure App Configuration operations:")
163
operations = client.operations.list()
164
165
for operation in operations:
166
print(f"\nOperation: {operation.name}")
167
if operation.display:
168
print(f" Provider: {operation.display.provider}")
169
print(f" Resource: {operation.display.resource}")
170
print(f" Operation: {operation.display.operation}")
171
print(f" Description: {operation.display.description}")
172
173
if operation.properties and operation.properties.service_specification:
174
print(f" Service specification available: Yes")
175
```
176
177
## Related Models
178
179
### CheckNameAvailabilityParameters
180
181
```python { .api }
182
class CheckNameAvailabilityParameters:
183
"""
184
Parameters for checking name availability.
185
186
Attributes:
187
name: The name to check for availability
188
type: The resource type (always "Microsoft.AppConfiguration/configurationStores")
189
"""
190
191
def __init__(
192
self,
193
*,
194
name: str,
195
type: str = "Microsoft.AppConfiguration/configurationStores"
196
) -> None: ...
197
```
198
199
### NameAvailabilityStatus
200
201
```python { .api }
202
class NameAvailabilityStatus:
203
"""
204
Result of a name availability check.
205
206
Attributes:
207
name_available: Whether the name is available
208
reason: Reason why the name is not available (if applicable)
209
message: Detailed message about availability status
210
"""
211
212
name_available: Optional[bool]
213
reason: Optional[str]
214
message: Optional[str]
215
```
216
217
### OperationDefinition
218
219
```python { .api }
220
class OperationDefinition:
221
"""
222
Definition of an available operation.
223
224
Attributes:
225
name: Operation name
226
display: Display information for the operation
227
properties: Additional properties and specifications
228
"""
229
230
name: Optional[str]
231
display: Optional[OperationDefinitionDisplay]
232
properties: Optional[OperationProperties]
233
```
234
235
### OperationDefinitionDisplay
236
237
```python { .api }
238
class OperationDefinitionDisplay:
239
"""
240
Display information for an operation.
241
242
Attributes:
243
provider: The resource provider name
244
resource: The resource type
245
operation: The operation name for display
246
description: Description of the operation
247
"""
248
249
provider: Optional[str]
250
resource: Optional[str]
251
operation: Optional[str]
252
description: Optional[str]
253
```
254
255
## Error Handling
256
257
Name availability operations can fail with various errors:
258
259
```python
260
from azure.core.exceptions import HttpResponseError
261
262
try:
263
availability = client.operations.check_name_availability(params)
264
except HttpResponseError as e:
265
print(f"Error checking name availability: {e.status_code}")
266
print(f"Error message: {e.message}")
267
```
268
269
## Best Practices
270
271
1. **Always check name availability** before attempting to create a configuration store
272
2. **Use regional checks** when you know the target region to get more accurate availability information
273
3. **Handle unavailable names gracefully** by suggesting alternatives or prompting for different names
274
4. **Cache operation listings** if you need to repeatedly check available operations
275
5. **Consider name uniqueness requirements** - configuration store names must be globally unique across all Azure subscriptions