0
# Models and Types
1
2
Comprehensive data structures including request/response models, enumerations, and error handling types for all API operations. These types define the structure of data exchanged with the Azure ComputeSchedule service.
3
4
## Core Data Models
5
6
### Schedule Configuration
7
8
```python { .api }
9
class Schedule:
10
"""
11
Schedule configuration for timed operations.
12
13
Attributes:
14
- deadline_type: DeadlineType - Type of deadline (INITIATE_AT, COMPLETE_BY, UNKNOWN)
15
- deadline: str - ISO 8601 datetime string for operation execution
16
- timezone: str - Timezone identifier (e.g., "UTC", "America/New_York")
17
"""
18
deadline_type: DeadlineType
19
deadline: str
20
timezone: str
21
```
22
23
### Execution Parameters
24
25
```python { .api }
26
class ExecutionParameters:
27
"""
28
Parameters controlling how operations are executed.
29
30
Attributes:
31
- resources: Resources - Target resources for the operation (required)
32
- optimization_preference: OptimizationPreference - Speed vs cost optimization (optional)
33
- retry_policy: RetryPolicy - Retry configuration for failed operations (optional)
34
"""
35
resources: Resources
36
optimization_preference: Optional[OptimizationPreference]
37
retry_policy: Optional[RetryPolicy]
38
```
39
40
### Resource Specifications
41
42
```python { .api }
43
class Resources:
44
"""
45
Specification of target Azure resources.
46
47
Attributes:
48
- ids: List[str] - List of Azure Resource Manager resource IDs
49
"""
50
ids: List[str]
51
52
class ResourceProvisionPayload:
53
"""
54
Payload for resource provisioning operations.
55
56
Contains configuration parameters for creating new VM resources.
57
Specific attributes depend on resource type and configuration requirements.
58
"""
59
```
60
61
### Retry Configuration
62
63
```python { .api }
64
class RetryPolicy:
65
"""
66
Retry policy configuration for failed operations.
67
68
Attributes:
69
- retry_count: int - Number of retry attempts
70
- retry_window_in_minutes: int - Time window for retry attempts
71
"""
72
retry_count: int
73
retry_window_in_minutes: int
74
```
75
76
## Request Models
77
78
### Scheduled Operation Requests
79
80
```python { .api }
81
class SubmitDeallocateRequest:
82
"""
83
Request for scheduled deallocate operations.
84
85
Attributes:
86
- schedule: Schedule - When to execute the operation (required)
87
- execution_parameters: ExecutionParameters - How to execute the operation (required)
88
"""
89
schedule: Schedule
90
execution_parameters: ExecutionParameters
91
92
class SubmitHibernateRequest:
93
"""
94
Request for scheduled hibernate operations.
95
96
Attributes:
97
- schedule: Schedule - When to execute the operation (required)
98
- execution_parameters: ExecutionParameters - How to execute the operation (required)
99
"""
100
schedule: Schedule
101
execution_parameters: ExecutionParameters
102
103
class SubmitStartRequest:
104
"""
105
Request for scheduled start operations.
106
107
Attributes:
108
- schedule: Schedule - When to execute the operation (required)
109
- execution_parameters: ExecutionParameters - How to execute the operation (required)
110
"""
111
schedule: Schedule
112
execution_parameters: ExecutionParameters
113
```
114
115
### Immediate Operation Requests
116
117
```python { .api }
118
class ExecuteDeallocateRequest:
119
"""
120
Request for immediate deallocate operations.
121
122
Attributes:
123
- execution_parameters: ExecutionParameters - How to execute the operation (required)
124
"""
125
execution_parameters: ExecutionParameters
126
127
class ExecuteHibernateRequest:
128
"""
129
Request for immediate hibernate operations.
130
131
Attributes:
132
- execution_parameters: ExecutionParameters - How to execute the operation (required)
133
"""
134
execution_parameters: ExecutionParameters
135
136
class ExecuteStartRequest:
137
"""
138
Request for immediate start operations.
139
140
Attributes:
141
- execution_parameters: ExecutionParameters - How to execute the operation (required)
142
"""
143
execution_parameters: ExecutionParameters
144
145
class ExecuteCreateRequest:
146
"""
147
Request for immediate create operations.
148
149
Attributes:
150
- resource_config_parameters: ResourceProvisionPayload - Resource creation configuration (required)
151
"""
152
resource_config_parameters: ResourceProvisionPayload
153
154
class ExecuteDeleteRequest:
155
"""
156
Request for immediate delete operations.
157
158
Attributes:
159
- execution_parameters: ExecutionParameters - How to execute the operation (required)
160
"""
161
execution_parameters: ExecutionParameters
162
```
163
164
### Management Operation Requests
165
166
```python { .api }
167
class GetOperationStatusRequest:
168
"""
169
Request to get operation status using operation IDs.
170
171
Attributes:
172
- operation_ids: List[str] - List of operation IDs to query (required)
173
"""
174
operation_ids: List[str]
175
176
class CancelOperationsRequest:
177
"""
178
Request to cancel running operations using operation IDs.
179
180
Attributes:
181
- operation_ids: List[str] - List of operation IDs to cancel (required)
182
"""
183
operation_ids: List[str]
184
185
class GetOperationErrorsRequest:
186
"""
187
Request to get error details for operations.
188
189
Attributes:
190
- operation_ids: List[str] - List of operation IDs to query errors (required)
191
"""
192
operation_ids: List[str]
193
```
194
195
## Response Models
196
197
### Operation Response Models
198
199
```python { .api }
200
class DeallocateResourceOperationResponse:
201
"""
202
Response for deallocate operations.
203
204
Attributes:
205
- operation_id: str - Unique identifier for the operation
206
- type: str - Operation type
207
- location: str - Azure region where operation executes
208
- status: str - Current operation status
209
"""
210
operation_id: str
211
type: str
212
location: str
213
status: str
214
215
class HibernateResourceOperationResponse:
216
"""
217
Response for hibernate operations.
218
219
Attributes:
220
- operation_id: str - Unique identifier for the operation
221
- type: str - Operation type
222
- location: str - Azure region where operation executes
223
- status: str - Current operation status
224
"""
225
operation_id: str
226
type: str
227
location: str
228
status: str
229
230
class StartResourceOperationResponse:
231
"""
232
Response for start operations.
233
234
Attributes:
235
- operation_id: str - Unique identifier for the operation
236
- type: str - Operation type
237
- location: str - Azure region where operation executes
238
- status: str - Current operation status
239
"""
240
operation_id: str
241
type: str
242
location: str
243
status: str
244
245
class CreateResourceOperationResponse:
246
"""
247
Response for create operations.
248
249
Attributes:
250
- operation_id: str - Unique identifier for the operation
251
- type: str - Operation type
252
- location: str - Azure region where operation executes
253
- status: str - Current operation status
254
"""
255
operation_id: str
256
type: str
257
location: str
258
status: str
259
260
class DeleteResourceOperationResponse:
261
"""
262
Response for delete operations.
263
264
Attributes:
265
- operation_id: str - Unique identifier for the operation
266
- type: str - Operation type
267
- location: str - Azure region where operation executes
268
- status: str - Current operation status
269
"""
270
operation_id: str
271
type: str
272
location: str
273
status: str
274
```
275
276
### Management Response Models
277
278
```python { .api }
279
class GetOperationStatusResponse:
280
"""
281
Response containing operation status information.
282
283
Attributes:
284
- results: List[ResourceOperationDetails] - Status details for each requested operation
285
"""
286
results: List[ResourceOperationDetails]
287
288
class CancelOperationsResponse:
289
"""
290
Response for operation cancellation requests.
291
292
Attributes:
293
- results: List[ResourceOperation] - Cancellation results for each operation
294
"""
295
results: List[ResourceOperation]
296
297
class GetOperationErrorsResponse:
298
"""
299
Response containing detailed error information.
300
301
Attributes:
302
- results: List[OperationErrorsResult] - Error details for each requested operation
303
"""
304
results: List[OperationErrorsResult]
305
```
306
307
### Detailed Data Models
308
309
```python { .api }
310
class ResourceOperationDetails:
311
"""
312
Detailed information about a resource operation.
313
314
Attributes:
315
- operation_id: str - Unique operation identifier
316
- state: OperationState - Current operation state
317
- completion_time: str - ISO 8601 completion timestamp (if completed)
318
- progress_percentage: int - Execution progress percentage
319
- error_message: str - Error message (if failed)
320
"""
321
operation_id: str
322
state: OperationState
323
completion_time: Optional[str]
324
progress_percentage: Optional[int]
325
error_message: Optional[str]
326
327
class ResourceOperation:
328
"""
329
Basic resource operation information.
330
331
Attributes:
332
- operation_id: str - Unique operation identifier
333
- cancelled: bool - Whether operation was successfully cancelled
334
- reason: str - Reason if cancellation failed
335
"""
336
operation_id: str
337
cancelled: bool
338
reason: Optional[str]
339
340
class OperationErrorsResult:
341
"""
342
Error information for a specific operation.
343
344
Attributes:
345
- operation_id: str - Operation identifier
346
- errors: List[ResourceOperationError] - List of errors that occurred
347
"""
348
operation_id: str
349
errors: List[ResourceOperationError]
350
351
class ResourceOperationError:
352
"""
353
Detailed error information for operation failures.
354
355
Attributes:
356
- error_code: str - Standardized error code
357
- error_message: str - Human-readable error description
358
- target_resource: str - Resource ID that caused the error
359
- additional_info: str - Additional error context
360
"""
361
error_code: str
362
error_message: str
363
target_resource: Optional[str]
364
additional_info: Optional[str]
365
```
366
367
### Provider Operations Models
368
369
```python { .api }
370
class Operation:
371
"""
372
Available provider operation definition.
373
374
Attributes:
375
- name: str - Operation name
376
- display: OperationDisplay - Display information for the operation
377
"""
378
name: str
379
display: OperationDisplay
380
381
class OperationDisplay:
382
"""
383
Display information for provider operations.
384
385
Attributes:
386
- provider: str - Provider name
387
- resource: str - Resource type
388
- operation: str - Operation name
389
- description: str - Operation description
390
"""
391
provider: str
392
resource: str
393
operation: str
394
description: str
395
396
class OperationErrorDetails:
397
"""
398
Error details for operation failures.
399
400
Attributes:
401
- error_code: str - Error code
402
- error_message: str - Error message
403
- target: str - Error target
404
"""
405
error_code: str
406
error_message: str
407
target: Optional[str]
408
```
409
410
## Enumerations
411
412
### Operation States
413
414
```python { .api }
415
class OperationState(str, Enum):
416
"""
417
States of operations in Scheduled Actions.
418
"""
419
UNKNOWN = "Unknown" # Default value for operation state
420
PENDING_SCHEDULING = "PendingScheduling" # Operations pending scheduling
421
SCHEDULED = "Scheduled" # Operations that have been scheduled
422
PENDING_EXECUTION = "PendingExecution" # Operations waiting to be executed
423
EXECUTING = "Executing" # Operations in process of execution
424
SUCCEEDED = "Succeeded" # Operations that succeeded
425
FAILED = "Failed" # Operations that have failed
426
CANCELLED = "Cancelled" # Operations that were cancelled
427
BLOCKED = "Blocked" # Operations that are blocked
428
```
429
430
### Deadline Types
431
432
```python { .api }
433
class DeadlineType(str, Enum):
434
"""
435
Types of deadlines supported by ScheduledActions.
436
"""
437
UNKNOWN = "Unknown" # Default unknown value
438
INITIATE_AT = "InitiateAt" # Initiate operation at given deadline
439
COMPLETE_BY = "CompleteBy" # Complete operation by given deadline
440
```
441
442
### Optimization Preferences
443
444
```python { .api }
445
class OptimizationPreference(str, Enum):
446
"""
447
Optimization preferences for operation execution.
448
"""
449
COST = "Cost" # Optimize for lowest cost
450
AVAILABILITY = "Availability" # Optimize for resource availability
451
COST_AVAILABILITY_BALANCED = "CostAvailabilityBalanced" # Balance cost and availability
452
```
453
454
### Resource Operation Types
455
456
```python { .api }
457
class ResourceOperationType(str, Enum):
458
"""
459
Types of resource operations that can be performed.
460
"""
461
UNKNOWN = "Unknown" # Default unknown operation type
462
START = "Start" # Start virtual machines
463
DEALLOCATE = "Deallocate" # Deallocate virtual machines
464
HIBERNATE = "Hibernate" # Hibernate virtual machines
465
```
466
467
### Action Types
468
469
```python { .api }
470
class ActionType(str, Enum):
471
"""
472
Indicates the action type for operations.
473
"""
474
INTERNAL = "Internal" # Actions for internal-only APIs
475
```
476
477
### Origin Types
478
479
```python { .api }
480
class Origin(str, Enum):
481
"""
482
Origin of operations.
483
"""
484
USER = "user" # User-initiated operations
485
SYSTEM = "system" # System-initiated operations
486
USER_SYSTEM = "user,system" # Combined user and system operations
487
```
488
489
## Error Models
490
491
```python { .api }
492
class ErrorResponse:
493
"""
494
Standard error response format.
495
496
Attributes:
497
- error: ErrorDetail - Detailed error information
498
"""
499
error: ErrorDetail
500
501
class ErrorDetail:
502
"""
503
Detailed error information.
504
505
Attributes:
506
- code: str - Error code
507
- message: str - Error message
508
- target: str - Error target
509
- details: List[ErrorDetail] - Additional error details
510
- additional_info: List[ErrorAdditionalInfo] - Additional error information
511
"""
512
code: str
513
message: str
514
target: Optional[str]
515
details: Optional[List[ErrorDetail]]
516
additional_info: Optional[List[ErrorAdditionalInfo]]
517
518
class ErrorAdditionalInfo:
519
"""
520
Additional error information.
521
522
Attributes:
523
- type: str - Information type
524
- info: Any - Additional information object
525
"""
526
type: str
527
info: Any
528
```