0
# Service Operations
1
2
Discovery and metadata operations for Azure Maps service capabilities. This module provides information about available operations, service specifications, and API capabilities across the Azure Maps management plane.
3
4
## Imports
5
6
```python
7
from azure.mgmt.maps.models import (
8
OperationDetail, OperationDisplay, ServiceSpecification,
9
MetricSpecification, Dimension, MapsOperations
10
)
11
from typing import Iterable, List, Optional
12
```
13
14
## Capabilities
15
16
### Operations Discovery
17
18
Retrieve information about available operations supported by the Azure Maps management service.
19
20
```python { .api }
21
def list_operations(**kwargs) -> Iterable[OperationDetail]:
22
"""
23
List available operations for Azure Maps management.
24
25
Returns:
26
Iterable[OperationDetail]: Iterator of available operations
27
28
Usage:
29
Operations include account management, creator management,
30
and service metadata operations.
31
"""
32
33
def list_subscription_operations(**kwargs) -> Iterable[OperationDetail]:
34
"""
35
List operations available for the current subscription.
36
37
Returns:
38
Iterable[OperationDetail]: Iterator of subscription-specific operations
39
40
Usage:
41
May include subscription-level operations and resource provider
42
registrations specific to the current subscription context.
43
"""
44
```
45
46
Usage example:
47
48
```python
49
# Discover all available operations
50
operations = list(client.maps.list_operations())
51
52
print(f"Found {len(operations)} operations:")
53
for operation in operations:
54
print(f"- {operation.name}: {operation.display.description}")
55
if operation.display.provider:
56
print(f" Provider: {operation.display.provider}")
57
if operation.display.resource:
58
print(f" Resource: {operation.display.resource}")
59
print()
60
61
# Check subscription-specific operations
62
sub_operations = list(client.maps.list_subscription_operations())
63
print(f"Subscription operations: {len(sub_operations)}")
64
```
65
66
### API Capability Inspection
67
68
Examine service specifications and capabilities to understand what the Azure Maps service supports.
69
70
```python
71
# Analyze operation capabilities
72
operation_categories = {}
73
for operation in client.maps.list_operations():
74
category = operation.display.resource or "General"
75
if category not in operation_categories:
76
operation_categories[category] = []
77
operation_categories[category].append(operation.display.operation)
78
79
print("Operations by category:")
80
for category, ops in operation_categories.items():
81
print(f"{category}: {len(ops)} operations")
82
for op in ops[:3]: # Show first 3
83
print(f" - {op}")
84
if len(ops) > 3:
85
print(f" ... and {len(ops) - 3} more")
86
print()
87
```
88
89
## Operations Metadata Types
90
91
### Operation Information
92
93
```python { .api }
94
class OperationDetail:
95
"""Detailed information about a service operation."""
96
# Operation identification
97
name: Optional[str] # Operation name (e.g., "Microsoft.Maps/accounts/read")
98
is_data_action: Optional[bool] # Whether this is a data plane operation
99
100
# Human-readable information
101
display: Optional[OperationDisplay] # Display information
102
103
# Service specifications
104
service_specification: Optional[ServiceSpecification] # Service capabilities
105
origin: Optional[str] # Operation origin
106
action_type: Optional[str] # Action type classification
107
108
class OperationDisplay:
109
"""Human-readable operation information."""
110
provider: Optional[str] # Resource provider (e.g., "Microsoft Maps")
111
resource: Optional[str] # Resource type (e.g., "Maps Account")
112
operation: Optional[str] # Operation description (e.g., "Read Maps Account")
113
description: Optional[str] # Detailed description
114
```
115
116
### Service Specifications
117
118
```python { .api }
119
class ServiceSpecification:
120
"""Service capability and metric specifications."""
121
metric_specifications: Optional[List[MetricSpecification]] # Available metrics
122
log_specifications: Optional[List[object]] # Log specifications
123
124
class MetricSpecification:
125
"""Specification for service metrics."""
126
# Metric identification
127
name: Optional[str] # Metric name
128
display_name: Optional[str] # Human-readable name
129
display_description: Optional[str] # Metric description
130
131
# Metric properties
132
unit: Optional[str] # Metric unit (e.g., "Count", "Bytes")
133
aggregation_type: Optional[str] # Aggregation method
134
dimensions: Optional[List[Dimension]] # Metric dimensions
135
136
# Availability
137
fill_gap_with_zero: Optional[bool] # Whether to fill gaps with zero
138
category: Optional[str] # Metric category
139
resource_id_dimension_name_override: Optional[str] # Resource ID dimension override
140
141
class Dimension:
142
"""Metric dimension specification."""
143
name: Optional[str] # Dimension name
144
display_name: Optional[str] # Human-readable name
145
internal_name: Optional[str] # Internal dimension name
146
to_be_exported_for_shoebox: Optional[bool] # Export flag
147
```
148
149
### Operations Collections
150
151
```python { .api }
152
class MapsOperations:
153
"""Collection of Maps operations."""
154
value: Optional[List[OperationDetail]] # List of operations
155
next_link: Optional[str] # Link to next page
156
```
157
158
## Common Usage Patterns
159
160
### Service Health Monitoring
161
162
Use operations metadata to understand service capabilities and monitoring options:
163
164
```python
165
# Find operations related to monitoring and metrics
166
monitoring_operations = []
167
for operation in client.maps.list_operations():
168
if any(keyword in operation.name.lower() for keyword in ['metric', 'log', 'monitor', 'diagnos']):
169
monitoring_operations.append(operation)
170
171
print(f"Found {len(monitoring_operations)} monitoring-related operations")
172
173
# Examine available metrics
174
for operation in client.maps.list_operations():
175
if operation.service_specification and operation.service_specification.metric_specifications:
176
print(f"Operation {operation.name} provides metrics:")
177
for metric in operation.service_specification.metric_specifications:
178
print(f" - {metric.display_name}: {metric.display_description}")
179
print(f" Unit: {metric.unit}, Aggregation: {metric.aggregation_type}")
180
```
181
182
### Permission and Access Analysis
183
184
Understand what operations are available for security and access control planning:
185
186
```python
187
# Categorize operations by access level
188
read_operations = []
189
write_operations = []
190
delete_operations = []
191
192
for operation in client.maps.list_operations():
193
op_name = operation.name.lower()
194
if '/read' in op_name or 'list' in op_name or 'get' in op_name:
195
read_operations.append(operation)
196
elif '/delete' in op_name:
197
delete_operations.append(operation)
198
elif '/write' in op_name or 'create' in op_name or 'update' in op_name:
199
write_operations.append(operation)
200
201
print(f"Access patterns:")
202
print(f" Read operations: {len(read_operations)}")
203
print(f" Write operations: {len(write_operations)}")
204
print(f" Delete operations: {len(delete_operations)}")
205
206
# Show data actions vs management actions
207
data_actions = [op for op in client.maps.list_operations() if op.is_data_action]
208
mgmt_actions = [op for op in client.maps.list_operations() if not op.is_data_action]
209
210
print(f"\nAction types:")
211
print(f" Management actions: {len(mgmt_actions)}")
212
print(f" Data actions: {len(data_actions)}")
213
```
214
215
### API Version and Feature Discovery
216
217
Use operations information to understand API capabilities:
218
219
```python
220
# Examine operation origins and features
221
origins = {}
222
for operation in client.maps.list_operations():
223
origin = operation.origin or "Unknown"
224
if origin not in origins:
225
origins[origin] = []
226
origins[origin].append(operation.name)
227
228
print("Operations by origin:")
229
for origin, ops in origins.items():
230
print(f" {origin}: {len(ops)} operations")
231
232
# Look for specific resource types
233
resource_types = set()
234
for operation in client.maps.list_operations():
235
if operation.display and operation.display.resource:
236
resource_types.add(operation.display.resource)
237
238
print(f"\nSupported resource types: {', '.join(sorted(resource_types))}")
239
```