or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

tessl/pypi-azure-mgmt-computeschedule

Microsoft Azure ComputeSchedule Management Client Library for Python providing VM scheduling operations.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/azure-mgmt-computeschedule@1.1.x

To install, run

npx @tessl/cli install tessl/pypi-azure-mgmt-computeschedule@1.1.0

0

# Azure ComputeSchedule Management SDK

1

2

A Python management client library for Microsoft Azure ComputeSchedule service, enabling programmatic management of scheduled operations on Azure virtual machines. The library provides comprehensive APIs for submitting, canceling, and monitoring scheduled actions such as deallocate, hibernate, start, and restart operations on virtual machines, with support for both immediate and scheduled execution.

3

4

## Package Information

5

6

- **Package Name**: azure-mgmt-computeschedule

7

- **Language**: Python

8

- **Installation**: `pip install azure-mgmt-computeschedule azure-identity`

9

- **API Version**: 2025-05-01 (default)

10

11

## Core Imports

12

13

```python

14

from azure.mgmt.computeschedule import ComputeScheduleMgmtClient

15

from azure.identity import DefaultAzureCredential

16

```

17

18

For async operations:

19

20

```python

21

from azure.mgmt.computeschedule.aio import ComputeScheduleMgmtClient

22

```

23

24

## Basic Usage

25

26

```python

27

from azure.mgmt.computeschedule import ComputeScheduleMgmtClient

28

from azure.identity import DefaultAzureCredential

29

import os

30

31

# Initialize client

32

credential = DefaultAzureCredential()

33

subscription_id = os.getenv("AZURE_SUBSCRIPTION_ID")

34

client = ComputeScheduleMgmtClient(credential, subscription_id)

35

36

# Submit a scheduled deallocate operation

37

from azure.mgmt.computeschedule.models import (

38

SubmitDeallocateRequest,

39

Schedule,

40

ExecutionParameters,

41

Resources,

42

DeadlineType

43

)

44

45

# Define the schedule

46

schedule = Schedule(

47

deadline_type=DeadlineType.INITIATE_AT,

48

deadline="2024-01-15T10:00:00Z",

49

timezone="UTC"

50

)

51

52

# Define execution parameters

53

execution_params = ExecutionParameters(

54

resources=Resources(

55

ids=[

56

"/subscriptions/{subscription_id}/resourceGroups/myRG/providers/Microsoft.Compute/virtualMachines/myVM1",

57

"/subscriptions/{subscription_id}/resourceGroups/myRG/providers/Microsoft.Compute/virtualMachines/myVM2"

58

]

59

)

60

)

61

62

# Create request

63

request = SubmitDeallocateRequest(

64

schedule=schedule,

65

execution_parameters=execution_params

66

)

67

68

# Submit the operation

69

location = "eastus"

70

response = client.scheduled_actions.virtual_machines_submit_deallocate(

71

locationparameter=location,

72

request_body=request

73

)

74

75

print(f"Operation submitted with ID: {response.operation_id}")

76

```

77

78

## Architecture

79

80

The Azure ComputeSchedule SDK follows Azure ARM management patterns and provides two main operational modes:

81

82

- **Scheduled Operations**: Submit operations to be executed at a future time with deadline-based scheduling

83

- **Immediate Operations**: Execute operations immediately without scheduling delays

84

- **Operation Management**: Monitor, cancel, and retrieve error details for submitted operations

85

86

Key components:

87

- **ComputeScheduleMgmtClient**: Main client for both sync and async operations

88

- **Operations**: General provider operations interface

89

- **ScheduledActionsOperations**: VM-specific scheduling operations

90

- **Rich Model Hierarchy**: Request/response models, enums, and error handling types

91

92

## Capabilities

93

94

### Client Setup and Configuration

95

96

Initialize and configure the ComputeSchedule management client with Azure credentials, subscription targeting, and optional custom settings.

97

98

```python { .api }

99

class ComputeScheduleMgmtClient:

100

def __init__(

101

self,

102

credential: TokenCredential,

103

subscription_id: str,

104

base_url: Optional[str] = None,

105

**kwargs: Any

106

) -> None: ...

107

```

108

109

[Client Setup](./client-setup.md)

110

111

### Operations Discovery

112

113

List available operations for the ComputeSchedule resource provider, providing metadata about all operations supported by the service.

114

115

```python { .api }

116

def list(self, **kwargs: Any) -> ItemPaged[Operation]:

117

"""

118

List all operations available for the ComputeSchedule provider.

119

120

Returns:

121

Iterator of Operation objects containing operation metadata

122

"""

123

```

124

125

### Scheduled Operations

126

127

Submit VM operations to be executed at future scheduled times with deadline-based execution control and optimization preferences.

128

129

```python { .api }

130

def virtual_machines_submit_deallocate(

131

self,

132

locationparameter: str,

133

request_body: Union[SubmitDeallocateRequest, JSON, IO[bytes]],

134

**kwargs: Any

135

) -> DeallocateResourceOperationResponse: ...

136

137

def virtual_machines_submit_hibernate(

138

self,

139

locationparameter: str,

140

request_body: Union[SubmitHibernateRequest, JSON, IO[bytes]],

141

**kwargs: Any

142

) -> HibernateResourceOperationResponse: ...

143

144

def virtual_machines_submit_start(

145

self,

146

locationparameter: str,

147

request_body: Union[SubmitStartRequest, JSON, IO[bytes]],

148

**kwargs: Any

149

) -> StartResourceOperationResponse: ...

150

```

151

152

[Scheduled Operations](./scheduled-operations.md)

153

154

### Immediate Operations

155

156

Execute VM operations immediately without scheduling delays, providing direct control over virtual machine lifecycle operations.

157

158

```python { .api }

159

def virtual_machines_execute_deallocate(

160

self,

161

locationparameter: str,

162

request_body: Union[ExecuteDeallocateRequest, JSON, IO[bytes]],

163

**kwargs: Any

164

) -> DeallocateResourceOperationResponse: ...

165

166

def virtual_machines_execute_hibernate(

167

self,

168

locationparameter: str,

169

request_body: Union[ExecuteHibernateRequest, JSON, IO[bytes]],

170

**kwargs: Any

171

) -> HibernateResourceOperationResponse: ...

172

173

def virtual_machines_execute_start(

174

self,

175

locationparameter: str,

176

request_body: Union[ExecuteStartRequest, JSON, IO[bytes]],

177

**kwargs: Any

178

) -> StartResourceOperationResponse: ...

179

180

def virtual_machines_execute_create(

181

self,

182

locationparameter: str,

183

request_body: Union[ExecuteCreateRequest, JSON, IO[bytes]],

184

**kwargs: Any

185

) -> CreateResourceOperationResponse: ...

186

187

def virtual_machines_execute_delete(

188

self,

189

locationparameter: str,

190

request_body: Union[ExecuteDeleteRequest, JSON, IO[bytes]],

191

**kwargs: Any

192

) -> DeleteResourceOperationResponse: ...

193

```

194

195

[Immediate Operations](./immediate-operations.md)

196

197

### Operation Management

198

199

Monitor operation status, cancel running operations, and retrieve detailed error information for troubleshooting failed operations.

200

201

```python { .api }

202

def virtual_machines_get_operation_status(

203

self,

204

locationparameter: str,

205

request_body: Union[GetOperationStatusRequest, JSON, IO[bytes]],

206

**kwargs: Any

207

) -> GetOperationStatusResponse: ...

208

209

def virtual_machines_cancel_operations(

210

self,

211

locationparameter: str,

212

request_body: Union[CancelOperationsRequest, JSON, IO[bytes]],

213

**kwargs: Any

214

) -> CancelOperationsResponse: ...

215

216

def virtual_machines_get_operation_errors(

217

self,

218

locationparameter: str,

219

request_body: Union[GetOperationErrorsRequest, JSON, IO[bytes]],

220

**kwargs: Any

221

) -> GetOperationErrorsResponse: ...

222

```

223

224

[Operation Management](./operation-management.md)

225

226

### Models and Types

227

228

Comprehensive data structures including request/response models, enumerations, and error handling types for all API operations.

229

230

```python { .api }

231

class Schedule:

232

deadline_type: DeadlineType

233

deadline: str

234

timezone: str

235

236

class ExecutionParameters:

237

resources: Resources

238

optimization_preference: Optional[OptimizationPreference]

239

retry_policy: Optional[RetryPolicy]

240

241

class DeadlineType(str, Enum):

242

UNKNOWN = "Unknown"

243

INITIATE_AT = "InitiateAt"

244

COMPLETE_BY = "CompleteBy"

245

```

246

247

[Models and Types](./models-types.md)