| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System; |
| | 9 | | using System.Threading; |
| | 10 | | using System.Threading.Tasks; |
| | 11 | | using Azure; |
| | 12 | | using Azure.Core; |
| | 13 | | using Azure.Core.Pipeline; |
| | 14 | | using Azure.ResourceManager.Compute.Models; |
| | 15 | |
|
| | 16 | | namespace Azure.ResourceManager.Compute |
| | 17 | | { |
| | 18 | | /// <summary> The VirtualMachines service client. </summary> |
| | 19 | | public partial class VirtualMachinesOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 652 | 23 | | internal VirtualMachinesRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of VirtualMachinesOperations for mocking. </summary> |
| 396 | 25 | | protected VirtualMachinesOperations() |
| | 26 | | { |
| 396 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of VirtualMachinesOperations. </summary> |
| | 29 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 30 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 31 | | /// <param name="subscriptionId"> Subscription credentials which uniquely identify Microsoft Azure subscription. |
| | 32 | | /// <param name="endpoint"> server parameter. </param> |
| 396 | 33 | | internal VirtualMachinesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscripti |
| | 34 | | { |
| 396 | 35 | | RestClient = new VirtualMachinesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 396 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 396 | 37 | | _pipeline = pipeline; |
| 396 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Retrieves information about the model view or the instance view of a virtual machine. </summary> |
| | 41 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 42 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 43 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 44 | | public virtual async Task<Response<VirtualMachine>> GetAsync(string resourceGroupName, string vmName, Cancellati |
| | 45 | | { |
| 76 | 46 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.Get"); |
| 76 | 47 | | scope.Start(); |
| | 48 | | try |
| | 49 | | { |
| 76 | 50 | | return await RestClient.GetAsync(resourceGroupName, vmName, cancellationToken).ConfigureAwait(false); |
| | 51 | | } |
| 0 | 52 | | catch (Exception e) |
| | 53 | | { |
| 0 | 54 | | scope.Failed(e); |
| 0 | 55 | | throw; |
| | 56 | | } |
| 76 | 57 | | } |
| | 58 | |
|
| | 59 | | /// <summary> Retrieves information about the model view or the instance view of a virtual machine. </summary> |
| | 60 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 61 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 62 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 63 | | public virtual Response<VirtualMachine> Get(string resourceGroupName, string vmName, CancellationToken cancellat |
| | 64 | | { |
| 76 | 65 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.Get"); |
| 76 | 66 | | scope.Start(); |
| | 67 | | try |
| | 68 | | { |
| 76 | 69 | | return RestClient.Get(resourceGroupName, vmName, cancellationToken); |
| | 70 | | } |
| 0 | 71 | | catch (Exception e) |
| | 72 | | { |
| 0 | 73 | | scope.Failed(e); |
| 0 | 74 | | throw; |
| | 75 | | } |
| 76 | 76 | | } |
| | 77 | |
|
| | 78 | | /// <summary> Retrieves information about the run-time state of a virtual machine. </summary> |
| | 79 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 80 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 81 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 82 | | public virtual async Task<Response<VirtualMachineInstanceView>> InstanceViewAsync(string resourceGroupName, stri |
| | 83 | | { |
| 8 | 84 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.InstanceView"); |
| 8 | 85 | | scope.Start(); |
| | 86 | | try |
| | 87 | | { |
| 8 | 88 | | return await RestClient.InstanceViewAsync(resourceGroupName, vmName, cancellationToken).ConfigureAwait(f |
| | 89 | | } |
| 0 | 90 | | catch (Exception e) |
| | 91 | | { |
| 0 | 92 | | scope.Failed(e); |
| 0 | 93 | | throw; |
| | 94 | | } |
| 8 | 95 | | } |
| | 96 | |
|
| | 97 | | /// <summary> Retrieves information about the run-time state of a virtual machine. </summary> |
| | 98 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 99 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 100 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 101 | | public virtual Response<VirtualMachineInstanceView> InstanceView(string resourceGroupName, string vmName, Cancel |
| | 102 | | { |
| 8 | 103 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.InstanceView"); |
| 8 | 104 | | scope.Start(); |
| | 105 | | try |
| | 106 | | { |
| 8 | 107 | | return RestClient.InstanceView(resourceGroupName, vmName, cancellationToken); |
| | 108 | | } |
| 0 | 109 | | catch (Exception e) |
| | 110 | | { |
| 0 | 111 | | scope.Failed(e); |
| 0 | 112 | | throw; |
| | 113 | | } |
| 8 | 114 | | } |
| | 115 | |
|
| | 116 | | /// <summary> Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual |
| | 117 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 118 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 119 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 120 | | public virtual async Task<Response> GeneralizeAsync(string resourceGroupName, string vmName, CancellationToken c |
| | 121 | | { |
| 0 | 122 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.Generalize"); |
| 0 | 123 | | scope.Start(); |
| | 124 | | try |
| | 125 | | { |
| 0 | 126 | | return await RestClient.GeneralizeAsync(resourceGroupName, vmName, cancellationToken).ConfigureAwait(fal |
| | 127 | | } |
| 0 | 128 | | catch (Exception e) |
| | 129 | | { |
| 0 | 130 | | scope.Failed(e); |
| 0 | 131 | | throw; |
| | 132 | | } |
| 0 | 133 | | } |
| | 134 | |
|
| | 135 | | /// <summary> Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual |
| | 136 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 137 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 138 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 139 | | public virtual Response Generalize(string resourceGroupName, string vmName, CancellationToken cancellationToken |
| | 140 | | { |
| 0 | 141 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.Generalize"); |
| 0 | 142 | | scope.Start(); |
| | 143 | | try |
| | 144 | | { |
| 0 | 145 | | return RestClient.Generalize(resourceGroupName, vmName, cancellationToken); |
| | 146 | | } |
| 0 | 147 | | catch (Exception e) |
| | 148 | | { |
| 0 | 149 | | scope.Failed(e); |
| 0 | 150 | | throw; |
| | 151 | | } |
| 0 | 152 | | } |
| | 153 | |
|
| | 154 | | /// <summary> The operation to simulate the eviction of spot virtual machine. The eviction will occur within 30 |
| | 155 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 156 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 157 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 158 | | public virtual async Task<Response> SimulateEvictionAsync(string resourceGroupName, string vmName, CancellationT |
| | 159 | | { |
| 2 | 160 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.SimulateEviction"); |
| 2 | 161 | | scope.Start(); |
| | 162 | | try |
| | 163 | | { |
| 2 | 164 | | return await RestClient.SimulateEvictionAsync(resourceGroupName, vmName, cancellationToken).ConfigureAwa |
| | 165 | | } |
| 0 | 166 | | catch (Exception e) |
| | 167 | | { |
| 0 | 168 | | scope.Failed(e); |
| 0 | 169 | | throw; |
| | 170 | | } |
| 2 | 171 | | } |
| | 172 | |
|
| | 173 | | /// <summary> The operation to simulate the eviction of spot virtual machine. The eviction will occur within 30 |
| | 174 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 175 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 176 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 177 | | public virtual Response SimulateEviction(string resourceGroupName, string vmName, CancellationToken cancellation |
| | 178 | | { |
| 2 | 179 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.SimulateEviction"); |
| 2 | 180 | | scope.Start(); |
| | 181 | | try |
| | 182 | | { |
| 2 | 183 | | return RestClient.SimulateEviction(resourceGroupName, vmName, cancellationToken); |
| | 184 | | } |
| 0 | 185 | | catch (Exception e) |
| | 186 | | { |
| 0 | 187 | | scope.Failed(e); |
| 0 | 188 | | throw; |
| | 189 | | } |
| 2 | 190 | | } |
| | 191 | |
|
| | 192 | | /// <summary> Gets all the virtual machines under the specified subscription for the specified location. </summa |
| | 193 | | /// <param name="location"> The location for which virtual machines under the subscription are queried. </param> |
| | 194 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 195 | | public virtual AsyncPageable<VirtualMachine> ListByLocationAsync(string location, CancellationToken cancellation |
| | 196 | | { |
| 2 | 197 | | if (location == null) |
| | 198 | | { |
| 0 | 199 | | throw new ArgumentNullException(nameof(location)); |
| | 200 | | } |
| | 201 | |
|
| | 202 | | async Task<Page<VirtualMachine>> FirstPageFunc(int? pageSizeHint) |
| | 203 | | { |
| 2 | 204 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListByLocation"); |
| 2 | 205 | | scope.Start(); |
| | 206 | | try |
| | 207 | | { |
| 2 | 208 | | var response = await RestClient.ListByLocationAsync(location, cancellationToken).ConfigureAwait(fals |
| 2 | 209 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 210 | | } |
| 0 | 211 | | catch (Exception e) |
| | 212 | | { |
| 0 | 213 | | scope.Failed(e); |
| 0 | 214 | | throw; |
| | 215 | | } |
| 2 | 216 | | } |
| | 217 | | async Task<Page<VirtualMachine>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 218 | | { |
| 0 | 219 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListByLocation"); |
| 0 | 220 | | scope.Start(); |
| | 221 | | try |
| | 222 | | { |
| 0 | 223 | | var response = await RestClient.ListByLocationNextPageAsync(nextLink, location, cancellationToken).C |
| 0 | 224 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 225 | | } |
| 0 | 226 | | catch (Exception e) |
| | 227 | | { |
| 0 | 228 | | scope.Failed(e); |
| 0 | 229 | | throw; |
| | 230 | | } |
| 0 | 231 | | } |
| 2 | 232 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 233 | | } |
| | 234 | |
|
| | 235 | | /// <summary> Gets all the virtual machines under the specified subscription for the specified location. </summa |
| | 236 | | /// <param name="location"> The location for which virtual machines under the subscription are queried. </param> |
| | 237 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 238 | | public virtual Pageable<VirtualMachine> ListByLocation(string location, CancellationToken cancellationToken = de |
| | 239 | | { |
| 2 | 240 | | if (location == null) |
| | 241 | | { |
| 0 | 242 | | throw new ArgumentNullException(nameof(location)); |
| | 243 | | } |
| | 244 | |
|
| | 245 | | Page<VirtualMachine> FirstPageFunc(int? pageSizeHint) |
| | 246 | | { |
| 2 | 247 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListByLocation"); |
| 2 | 248 | | scope.Start(); |
| | 249 | | try |
| | 250 | | { |
| 2 | 251 | | var response = RestClient.ListByLocation(location, cancellationToken); |
| 2 | 252 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 253 | | } |
| 0 | 254 | | catch (Exception e) |
| | 255 | | { |
| 0 | 256 | | scope.Failed(e); |
| 0 | 257 | | throw; |
| | 258 | | } |
| 2 | 259 | | } |
| | 260 | | Page<VirtualMachine> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 261 | | { |
| 0 | 262 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListByLocation"); |
| 0 | 263 | | scope.Start(); |
| | 264 | | try |
| | 265 | | { |
| 0 | 266 | | var response = RestClient.ListByLocationNextPage(nextLink, location, cancellationToken); |
| 0 | 267 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 268 | | } |
| 0 | 269 | | catch (Exception e) |
| | 270 | | { |
| 0 | 271 | | scope.Failed(e); |
| 0 | 272 | | throw; |
| | 273 | | } |
| 0 | 274 | | } |
| 2 | 275 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 276 | | } |
| | 277 | |
|
| | 278 | | /// <summary> Lists all of the virtual machines in the specified resource group. Use the nextLink property in th |
| | 279 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 280 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 281 | | public virtual AsyncPageable<VirtualMachine> ListAsync(string resourceGroupName, CancellationToken cancellationT |
| | 282 | | { |
| 8 | 283 | | if (resourceGroupName == null) |
| | 284 | | { |
| 0 | 285 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 286 | | } |
| | 287 | |
|
| | 288 | | async Task<Page<VirtualMachine>> FirstPageFunc(int? pageSizeHint) |
| | 289 | | { |
| 8 | 290 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.List"); |
| 8 | 291 | | scope.Start(); |
| | 292 | | try |
| | 293 | | { |
| 8 | 294 | | var response = await RestClient.ListAsync(resourceGroupName, cancellationToken).ConfigureAwait(false |
| 8 | 295 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 296 | | } |
| 0 | 297 | | catch (Exception e) |
| | 298 | | { |
| 0 | 299 | | scope.Failed(e); |
| 0 | 300 | | throw; |
| | 301 | | } |
| 8 | 302 | | } |
| | 303 | | async Task<Page<VirtualMachine>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 304 | | { |
| 0 | 305 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.List"); |
| 0 | 306 | | scope.Start(); |
| | 307 | | try |
| | 308 | | { |
| 0 | 309 | | var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, cancellationToken).Co |
| 0 | 310 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 311 | | } |
| 0 | 312 | | catch (Exception e) |
| | 313 | | { |
| 0 | 314 | | scope.Failed(e); |
| 0 | 315 | | throw; |
| | 316 | | } |
| 0 | 317 | | } |
| 8 | 318 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 319 | | } |
| | 320 | |
|
| | 321 | | /// <summary> Lists all of the virtual machines in the specified resource group. Use the nextLink property in th |
| | 322 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 323 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 324 | | public virtual Pageable<VirtualMachine> List(string resourceGroupName, CancellationToken cancellationToken = def |
| | 325 | | { |
| 8 | 326 | | if (resourceGroupName == null) |
| | 327 | | { |
| 0 | 328 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 329 | | } |
| | 330 | |
|
| | 331 | | Page<VirtualMachine> FirstPageFunc(int? pageSizeHint) |
| | 332 | | { |
| 8 | 333 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.List"); |
| 8 | 334 | | scope.Start(); |
| | 335 | | try |
| | 336 | | { |
| 8 | 337 | | var response = RestClient.List(resourceGroupName, cancellationToken); |
| 8 | 338 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 339 | | } |
| 0 | 340 | | catch (Exception e) |
| | 341 | | { |
| 0 | 342 | | scope.Failed(e); |
| 0 | 343 | | throw; |
| | 344 | | } |
| 8 | 345 | | } |
| | 346 | | Page<VirtualMachine> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 347 | | { |
| 0 | 348 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.List"); |
| 0 | 349 | | scope.Start(); |
| | 350 | | try |
| | 351 | | { |
| 0 | 352 | | var response = RestClient.ListNextPage(nextLink, resourceGroupName, cancellationToken); |
| 0 | 353 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 354 | | } |
| 0 | 355 | | catch (Exception e) |
| | 356 | | { |
| 0 | 357 | | scope.Failed(e); |
| 0 | 358 | | throw; |
| | 359 | | } |
| 0 | 360 | | } |
| 8 | 361 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 362 | | } |
| | 363 | |
|
| | 364 | | /// <summary> Lists all of the virtual machines in the specified subscription. Use the nextLink property in the |
| | 365 | | /// <param name="statusOnly"> statusOnly=true enables fetching run time status of all Virtual Machines in the su |
| | 366 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 367 | | public virtual AsyncPageable<VirtualMachine> ListAllAsync(string statusOnly = null, CancellationToken cancellati |
| | 368 | | { |
| | 369 | | async Task<Page<VirtualMachine>> FirstPageFunc(int? pageSizeHint) |
| | 370 | | { |
| 10 | 371 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListAll"); |
| 10 | 372 | | scope.Start(); |
| | 373 | | try |
| | 374 | | { |
| 10 | 375 | | var response = await RestClient.ListAllAsync(statusOnly, cancellationToken).ConfigureAwait(false); |
| 10 | 376 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 377 | | } |
| 0 | 378 | | catch (Exception e) |
| | 379 | | { |
| 0 | 380 | | scope.Failed(e); |
| 0 | 381 | | throw; |
| | 382 | | } |
| 10 | 383 | | } |
| | 384 | | async Task<Page<VirtualMachine>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 385 | | { |
| 0 | 386 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListAll"); |
| 0 | 387 | | scope.Start(); |
| | 388 | | try |
| | 389 | | { |
| 0 | 390 | | var response = await RestClient.ListAllNextPageAsync(nextLink, statusOnly, cancellationToken).Config |
| 0 | 391 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 392 | | } |
| 0 | 393 | | catch (Exception e) |
| | 394 | | { |
| 0 | 395 | | scope.Failed(e); |
| 0 | 396 | | throw; |
| | 397 | | } |
| 0 | 398 | | } |
| 10 | 399 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 400 | | } |
| | 401 | |
|
| | 402 | | /// <summary> Lists all of the virtual machines in the specified subscription. Use the nextLink property in the |
| | 403 | | /// <param name="statusOnly"> statusOnly=true enables fetching run time status of all Virtual Machines in the su |
| | 404 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 405 | | public virtual Pageable<VirtualMachine> ListAll(string statusOnly = null, CancellationToken cancellationToken = |
| | 406 | | { |
| | 407 | | Page<VirtualMachine> FirstPageFunc(int? pageSizeHint) |
| | 408 | | { |
| 10 | 409 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListAll"); |
| 10 | 410 | | scope.Start(); |
| | 411 | | try |
| | 412 | | { |
| 10 | 413 | | var response = RestClient.ListAll(statusOnly, cancellationToken); |
| 10 | 414 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 415 | | } |
| 0 | 416 | | catch (Exception e) |
| | 417 | | { |
| 0 | 418 | | scope.Failed(e); |
| 0 | 419 | | throw; |
| | 420 | | } |
| 10 | 421 | | } |
| | 422 | | Page<VirtualMachine> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 423 | | { |
| 0 | 424 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListAll"); |
| 0 | 425 | | scope.Start(); |
| | 426 | | try |
| | 427 | | { |
| 0 | 428 | | var response = RestClient.ListAllNextPage(nextLink, statusOnly, cancellationToken); |
| 0 | 429 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 430 | | } |
| 0 | 431 | | catch (Exception e) |
| | 432 | | { |
| 0 | 433 | | scope.Failed(e); |
| 0 | 434 | | throw; |
| | 435 | | } |
| 0 | 436 | | } |
| 10 | 437 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 438 | | } |
| | 439 | |
|
| | 440 | | /// <summary> Lists all available virtual machine sizes to which the specified virtual machine can be resized. < |
| | 441 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 442 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 443 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 444 | | public virtual AsyncPageable<VirtualMachineSize> ListAvailableSizesAsync(string resourceGroupName, string vmName |
| | 445 | | { |
| 8 | 446 | | if (resourceGroupName == null) |
| | 447 | | { |
| 0 | 448 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 449 | | } |
| 8 | 450 | | if (vmName == null) |
| | 451 | | { |
| 0 | 452 | | throw new ArgumentNullException(nameof(vmName)); |
| | 453 | | } |
| | 454 | |
|
| | 455 | | async Task<Page<VirtualMachineSize>> FirstPageFunc(int? pageSizeHint) |
| | 456 | | { |
| 8 | 457 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListAvailableSizes"); |
| 8 | 458 | | scope.Start(); |
| | 459 | | try |
| | 460 | | { |
| 8 | 461 | | var response = await RestClient.ListAvailableSizesAsync(resourceGroupName, vmName, cancellationToken |
| 8 | 462 | | return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); |
| | 463 | | } |
| 0 | 464 | | catch (Exception e) |
| | 465 | | { |
| 0 | 466 | | scope.Failed(e); |
| 0 | 467 | | throw; |
| | 468 | | } |
| 8 | 469 | | } |
| 8 | 470 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); |
| | 471 | | } |
| | 472 | |
|
| | 473 | | /// <summary> Lists all available virtual machine sizes to which the specified virtual machine can be resized. < |
| | 474 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 475 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 476 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 477 | | public virtual Pageable<VirtualMachineSize> ListAvailableSizes(string resourceGroupName, string vmName, Cancella |
| | 478 | | { |
| 8 | 479 | | if (resourceGroupName == null) |
| | 480 | | { |
| 0 | 481 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 482 | | } |
| 8 | 483 | | if (vmName == null) |
| | 484 | | { |
| 0 | 485 | | throw new ArgumentNullException(nameof(vmName)); |
| | 486 | | } |
| | 487 | |
|
| | 488 | | Page<VirtualMachineSize> FirstPageFunc(int? pageSizeHint) |
| | 489 | | { |
| 8 | 490 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.ListAvailableSizes"); |
| 8 | 491 | | scope.Start(); |
| | 492 | | try |
| | 493 | | { |
| 8 | 494 | | var response = RestClient.ListAvailableSizes(resourceGroupName, vmName, cancellationToken); |
| 8 | 495 | | return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); |
| | 496 | | } |
| 0 | 497 | | catch (Exception e) |
| | 498 | | { |
| 0 | 499 | | scope.Failed(e); |
| 0 | 500 | | throw; |
| | 501 | | } |
| 8 | 502 | | } |
| 8 | 503 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, null); |
| | 504 | | } |
| | 505 | |
|
| | 506 | | /// <summary> Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to |
| | 507 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 508 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 509 | | /// <param name="parameters"> Parameters supplied to the Capture Virtual Machine operation. </param> |
| | 510 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 511 | | public virtual async Task<VirtualMachinesCaptureOperation> StartCaptureAsync(string resourceGroupName, string vm |
| | 512 | | { |
| 0 | 513 | | if (resourceGroupName == null) |
| | 514 | | { |
| 0 | 515 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 516 | | } |
| 0 | 517 | | if (vmName == null) |
| | 518 | | { |
| 0 | 519 | | throw new ArgumentNullException(nameof(vmName)); |
| | 520 | | } |
| 0 | 521 | | if (parameters == null) |
| | 522 | | { |
| 0 | 523 | | throw new ArgumentNullException(nameof(parameters)); |
| | 524 | | } |
| | 525 | |
|
| 0 | 526 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartCapture"); |
| 0 | 527 | | scope.Start(); |
| | 528 | | try |
| | 529 | | { |
| 0 | 530 | | var originalResponse = await RestClient.CaptureAsync(resourceGroupName, vmName, parameters, cancellation |
| 0 | 531 | | return new VirtualMachinesCaptureOperation(_clientDiagnostics, _pipeline, RestClient.CreateCaptureReques |
| | 532 | | } |
| 0 | 533 | | catch (Exception e) |
| | 534 | | { |
| 0 | 535 | | scope.Failed(e); |
| 0 | 536 | | throw; |
| | 537 | | } |
| 0 | 538 | | } |
| | 539 | |
|
| | 540 | | /// <summary> Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to |
| | 541 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 542 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 543 | | /// <param name="parameters"> Parameters supplied to the Capture Virtual Machine operation. </param> |
| | 544 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 545 | | public virtual VirtualMachinesCaptureOperation StartCapture(string resourceGroupName, string vmName, VirtualMach |
| | 546 | | { |
| 0 | 547 | | if (resourceGroupName == null) |
| | 548 | | { |
| 0 | 549 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 550 | | } |
| 0 | 551 | | if (vmName == null) |
| | 552 | | { |
| 0 | 553 | | throw new ArgumentNullException(nameof(vmName)); |
| | 554 | | } |
| 0 | 555 | | if (parameters == null) |
| | 556 | | { |
| 0 | 557 | | throw new ArgumentNullException(nameof(parameters)); |
| | 558 | | } |
| | 559 | |
|
| 0 | 560 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartCapture"); |
| 0 | 561 | | scope.Start(); |
| | 562 | | try |
| | 563 | | { |
| 0 | 564 | | var originalResponse = RestClient.Capture(resourceGroupName, vmName, parameters, cancellationToken); |
| 0 | 565 | | return new VirtualMachinesCaptureOperation(_clientDiagnostics, _pipeline, RestClient.CreateCaptureReques |
| | 566 | | } |
| 0 | 567 | | catch (Exception e) |
| | 568 | | { |
| 0 | 569 | | scope.Failed(e); |
| 0 | 570 | | throw; |
| | 571 | | } |
| 0 | 572 | | } |
| | 573 | |
|
| | 574 | | /// <summary> The operation to create or update a virtual machine. Please note some properties can be set only d |
| | 575 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 576 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 577 | | /// <param name="parameters"> Parameters supplied to the Create Virtual Machine operation. </param> |
| | 578 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 579 | | public virtual async Task<VirtualMachinesCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroupN |
| | 580 | | { |
| 62 | 581 | | if (resourceGroupName == null) |
| | 582 | | { |
| 0 | 583 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 584 | | } |
| 62 | 585 | | if (vmName == null) |
| | 586 | | { |
| 0 | 587 | | throw new ArgumentNullException(nameof(vmName)); |
| | 588 | | } |
| 62 | 589 | | if (parameters == null) |
| | 590 | | { |
| 0 | 591 | | throw new ArgumentNullException(nameof(parameters)); |
| | 592 | | } |
| | 593 | |
|
| 62 | 594 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartCreateOrUpdate"); |
| 62 | 595 | | scope.Start(); |
| | 596 | | try |
| | 597 | | { |
| 62 | 598 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, vmName, parameters, cance |
| 60 | 599 | | return new VirtualMachinesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreate |
| | 600 | | } |
| 2 | 601 | | catch (Exception e) |
| | 602 | | { |
| 2 | 603 | | scope.Failed(e); |
| 2 | 604 | | throw; |
| | 605 | | } |
| 60 | 606 | | } |
| | 607 | |
|
| | 608 | | /// <summary> The operation to create or update a virtual machine. Please note some properties can be set only d |
| | 609 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 610 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 611 | | /// <param name="parameters"> Parameters supplied to the Create Virtual Machine operation. </param> |
| | 612 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 613 | | public virtual VirtualMachinesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string vmNam |
| | 614 | | { |
| 62 | 615 | | if (resourceGroupName == null) |
| | 616 | | { |
| 0 | 617 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 618 | | } |
| 62 | 619 | | if (vmName == null) |
| | 620 | | { |
| 0 | 621 | | throw new ArgumentNullException(nameof(vmName)); |
| | 622 | | } |
| 62 | 623 | | if (parameters == null) |
| | 624 | | { |
| 0 | 625 | | throw new ArgumentNullException(nameof(parameters)); |
| | 626 | | } |
| | 627 | |
|
| 62 | 628 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartCreateOrUpdate"); |
| 62 | 629 | | scope.Start(); |
| | 630 | | try |
| | 631 | | { |
| 62 | 632 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, vmName, parameters, cancellationToke |
| 60 | 633 | | return new VirtualMachinesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreate |
| | 634 | | } |
| 2 | 635 | | catch (Exception e) |
| | 636 | | { |
| 2 | 637 | | scope.Failed(e); |
| 2 | 638 | | throw; |
| | 639 | | } |
| 60 | 640 | | } |
| | 641 | |
|
| | 642 | | /// <summary> The operation to update a virtual machine. </summary> |
| | 643 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 644 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 645 | | /// <param name="parameters"> Parameters supplied to the Update Virtual Machine operation. </param> |
| | 646 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 647 | | public virtual async Task<VirtualMachinesUpdateOperation> StartUpdateAsync(string resourceGroupName, string vmNa |
| | 648 | | { |
| 2 | 649 | | if (resourceGroupName == null) |
| | 650 | | { |
| 0 | 651 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 652 | | } |
| 2 | 653 | | if (vmName == null) |
| | 654 | | { |
| 0 | 655 | | throw new ArgumentNullException(nameof(vmName)); |
| | 656 | | } |
| 2 | 657 | | if (parameters == null) |
| | 658 | | { |
| 0 | 659 | | throw new ArgumentNullException(nameof(parameters)); |
| | 660 | | } |
| | 661 | |
|
| 2 | 662 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartUpdate"); |
| 2 | 663 | | scope.Start(); |
| | 664 | | try |
| | 665 | | { |
| 2 | 666 | | var originalResponse = await RestClient.UpdateAsync(resourceGroupName, vmName, parameters, cancellationT |
| 2 | 667 | | return new VirtualMachinesUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest( |
| | 668 | | } |
| 0 | 669 | | catch (Exception e) |
| | 670 | | { |
| 0 | 671 | | scope.Failed(e); |
| 0 | 672 | | throw; |
| | 673 | | } |
| 2 | 674 | | } |
| | 675 | |
|
| | 676 | | /// <summary> The operation to update a virtual machine. </summary> |
| | 677 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 678 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 679 | | /// <param name="parameters"> Parameters supplied to the Update Virtual Machine operation. </param> |
| | 680 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 681 | | public virtual VirtualMachinesUpdateOperation StartUpdate(string resourceGroupName, string vmName, VirtualMachin |
| | 682 | | { |
| 2 | 683 | | if (resourceGroupName == null) |
| | 684 | | { |
| 0 | 685 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 686 | | } |
| 2 | 687 | | if (vmName == null) |
| | 688 | | { |
| 0 | 689 | | throw new ArgumentNullException(nameof(vmName)); |
| | 690 | | } |
| 2 | 691 | | if (parameters == null) |
| | 692 | | { |
| 0 | 693 | | throw new ArgumentNullException(nameof(parameters)); |
| | 694 | | } |
| | 695 | |
|
| 2 | 696 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartUpdate"); |
| 2 | 697 | | scope.Start(); |
| | 698 | | try |
| | 699 | | { |
| 2 | 700 | | var originalResponse = RestClient.Update(resourceGroupName, vmName, parameters, cancellationToken); |
| 2 | 701 | | return new VirtualMachinesUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest( |
| | 702 | | } |
| 0 | 703 | | catch (Exception e) |
| | 704 | | { |
| 0 | 705 | | scope.Failed(e); |
| 0 | 706 | | throw; |
| | 707 | | } |
| 2 | 708 | | } |
| | 709 | |
|
| | 710 | | /// <summary> The operation to delete a virtual machine. </summary> |
| | 711 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 712 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 713 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 714 | | public virtual async Task<VirtualMachinesDeleteOperation> StartDeleteAsync(string resourceGroupName, string vmNa |
| | 715 | | { |
| 26 | 716 | | if (resourceGroupName == null) |
| | 717 | | { |
| 0 | 718 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 719 | | } |
| 26 | 720 | | if (vmName == null) |
| | 721 | | { |
| 0 | 722 | | throw new ArgumentNullException(nameof(vmName)); |
| | 723 | | } |
| | 724 | |
|
| 26 | 725 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartDelete"); |
| 26 | 726 | | scope.Start(); |
| | 727 | | try |
| | 728 | | { |
| 26 | 729 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, vmName, cancellationToken).Config |
| 26 | 730 | | return new VirtualMachinesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest( |
| | 731 | | } |
| 0 | 732 | | catch (Exception e) |
| | 733 | | { |
| 0 | 734 | | scope.Failed(e); |
| 0 | 735 | | throw; |
| | 736 | | } |
| 26 | 737 | | } |
| | 738 | |
|
| | 739 | | /// <summary> The operation to delete a virtual machine. </summary> |
| | 740 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 741 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 742 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 743 | | public virtual VirtualMachinesDeleteOperation StartDelete(string resourceGroupName, string vmName, CancellationT |
| | 744 | | { |
| 26 | 745 | | if (resourceGroupName == null) |
| | 746 | | { |
| 0 | 747 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 748 | | } |
| 26 | 749 | | if (vmName == null) |
| | 750 | | { |
| 0 | 751 | | throw new ArgumentNullException(nameof(vmName)); |
| | 752 | | } |
| | 753 | |
|
| 26 | 754 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartDelete"); |
| 26 | 755 | | scope.Start(); |
| | 756 | | try |
| | 757 | | { |
| 26 | 758 | | var originalResponse = RestClient.Delete(resourceGroupName, vmName, cancellationToken); |
| 26 | 759 | | return new VirtualMachinesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest( |
| | 760 | | } |
| 0 | 761 | | catch (Exception e) |
| | 762 | | { |
| 0 | 763 | | scope.Failed(e); |
| 0 | 764 | | throw; |
| | 765 | | } |
| 26 | 766 | | } |
| | 767 | |
|
| | 768 | | /// <summary> Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deal |
| | 769 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 770 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 771 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 772 | | public virtual async Task<VirtualMachinesConvertToManagedDisksOperation> StartConvertToManagedDisksAsync(string |
| | 773 | | { |
| 0 | 774 | | if (resourceGroupName == null) |
| | 775 | | { |
| 0 | 776 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 777 | | } |
| 0 | 778 | | if (vmName == null) |
| | 779 | | { |
| 0 | 780 | | throw new ArgumentNullException(nameof(vmName)); |
| | 781 | | } |
| | 782 | |
|
| 0 | 783 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartConvertToManagedDisks"); |
| 0 | 784 | | scope.Start(); |
| | 785 | | try |
| | 786 | | { |
| 0 | 787 | | var originalResponse = await RestClient.ConvertToManagedDisksAsync(resourceGroupName, vmName, cancellati |
| 0 | 788 | | return new VirtualMachinesConvertToManagedDisksOperation(_clientDiagnostics, _pipeline, RestClient.Creat |
| | 789 | | } |
| 0 | 790 | | catch (Exception e) |
| | 791 | | { |
| 0 | 792 | | scope.Failed(e); |
| 0 | 793 | | throw; |
| | 794 | | } |
| 0 | 795 | | } |
| | 796 | |
|
| | 797 | | /// <summary> Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deal |
| | 798 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 799 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 800 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 801 | | public virtual VirtualMachinesConvertToManagedDisksOperation StartConvertToManagedDisks(string resourceGroupName |
| | 802 | | { |
| 0 | 803 | | if (resourceGroupName == null) |
| | 804 | | { |
| 0 | 805 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 806 | | } |
| 0 | 807 | | if (vmName == null) |
| | 808 | | { |
| 0 | 809 | | throw new ArgumentNullException(nameof(vmName)); |
| | 810 | | } |
| | 811 | |
|
| 0 | 812 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartConvertToManagedDisks"); |
| 0 | 813 | | scope.Start(); |
| | 814 | | try |
| | 815 | | { |
| 0 | 816 | | var originalResponse = RestClient.ConvertToManagedDisks(resourceGroupName, vmName, cancellationToken); |
| 0 | 817 | | return new VirtualMachinesConvertToManagedDisksOperation(_clientDiagnostics, _pipeline, RestClient.Creat |
| | 818 | | } |
| 0 | 819 | | catch (Exception e) |
| | 820 | | { |
| 0 | 821 | | scope.Failed(e); |
| 0 | 822 | | throw; |
| | 823 | | } |
| 0 | 824 | | } |
| | 825 | |
|
| | 826 | | /// <summary> Shuts down the virtual machine and releases the compute resources. You are not billed for the comp |
| | 827 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 828 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 829 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 830 | | public virtual async Task<VirtualMachinesDeallocateOperation> StartDeallocateAsync(string resourceGroupName, str |
| | 831 | | { |
| 2 | 832 | | if (resourceGroupName == null) |
| | 833 | | { |
| 0 | 834 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 835 | | } |
| 2 | 836 | | if (vmName == null) |
| | 837 | | { |
| 0 | 838 | | throw new ArgumentNullException(nameof(vmName)); |
| | 839 | | } |
| | 840 | |
|
| 2 | 841 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartDeallocate"); |
| 2 | 842 | | scope.Start(); |
| | 843 | | try |
| | 844 | | { |
| 2 | 845 | | var originalResponse = await RestClient.DeallocateAsync(resourceGroupName, vmName, cancellationToken).Co |
| 2 | 846 | | return new VirtualMachinesDeallocateOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeallocate |
| | 847 | | } |
| 0 | 848 | | catch (Exception e) |
| | 849 | | { |
| 0 | 850 | | scope.Failed(e); |
| 0 | 851 | | throw; |
| | 852 | | } |
| 2 | 853 | | } |
| | 854 | |
|
| | 855 | | /// <summary> Shuts down the virtual machine and releases the compute resources. You are not billed for the comp |
| | 856 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 857 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 858 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 859 | | public virtual VirtualMachinesDeallocateOperation StartDeallocate(string resourceGroupName, string vmName, Cance |
| | 860 | | { |
| 2 | 861 | | if (resourceGroupName == null) |
| | 862 | | { |
| 0 | 863 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 864 | | } |
| 2 | 865 | | if (vmName == null) |
| | 866 | | { |
| 0 | 867 | | throw new ArgumentNullException(nameof(vmName)); |
| | 868 | | } |
| | 869 | |
|
| 2 | 870 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartDeallocate"); |
| 2 | 871 | | scope.Start(); |
| | 872 | | try |
| | 873 | | { |
| 2 | 874 | | var originalResponse = RestClient.Deallocate(resourceGroupName, vmName, cancellationToken); |
| 2 | 875 | | return new VirtualMachinesDeallocateOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeallocate |
| | 876 | | } |
| 0 | 877 | | catch (Exception e) |
| | 878 | | { |
| 0 | 879 | | scope.Failed(e); |
| 0 | 880 | | throw; |
| | 881 | | } |
| 2 | 882 | | } |
| | 883 | |
|
| | 884 | | /// <summary> The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the |
| | 885 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 886 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 887 | | /// <param name="skipShutdown"> The parameter to request non-graceful VM shutdown. True value for this flag indi |
| | 888 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 889 | | public virtual async Task<VirtualMachinesPowerOffOperation> StartPowerOffAsync(string resourceGroupName, string |
| | 890 | | { |
| 2 | 891 | | if (resourceGroupName == null) |
| | 892 | | { |
| 0 | 893 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 894 | | } |
| 2 | 895 | | if (vmName == null) |
| | 896 | | { |
| 0 | 897 | | throw new ArgumentNullException(nameof(vmName)); |
| | 898 | | } |
| | 899 | |
|
| 2 | 900 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartPowerOff"); |
| 2 | 901 | | scope.Start(); |
| | 902 | | try |
| | 903 | | { |
| 2 | 904 | | var originalResponse = await RestClient.PowerOffAsync(resourceGroupName, vmName, skipShutdown, cancellat |
| 2 | 905 | | return new VirtualMachinesPowerOffOperation(_clientDiagnostics, _pipeline, RestClient.CreatePowerOffRequ |
| | 906 | | } |
| 0 | 907 | | catch (Exception e) |
| | 908 | | { |
| 0 | 909 | | scope.Failed(e); |
| 0 | 910 | | throw; |
| | 911 | | } |
| 2 | 912 | | } |
| | 913 | |
|
| | 914 | | /// <summary> The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the |
| | 915 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 916 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 917 | | /// <param name="skipShutdown"> The parameter to request non-graceful VM shutdown. True value for this flag indi |
| | 918 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 919 | | public virtual VirtualMachinesPowerOffOperation StartPowerOff(string resourceGroupName, string vmName, bool? ski |
| | 920 | | { |
| 2 | 921 | | if (resourceGroupName == null) |
| | 922 | | { |
| 0 | 923 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 924 | | } |
| 2 | 925 | | if (vmName == null) |
| | 926 | | { |
| 0 | 927 | | throw new ArgumentNullException(nameof(vmName)); |
| | 928 | | } |
| | 929 | |
|
| 2 | 930 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartPowerOff"); |
| 2 | 931 | | scope.Start(); |
| | 932 | | try |
| | 933 | | { |
| 2 | 934 | | var originalResponse = RestClient.PowerOff(resourceGroupName, vmName, skipShutdown, cancellationToken); |
| 2 | 935 | | return new VirtualMachinesPowerOffOperation(_clientDiagnostics, _pipeline, RestClient.CreatePowerOffRequ |
| | 936 | | } |
| 0 | 937 | | catch (Exception e) |
| | 938 | | { |
| 0 | 939 | | scope.Failed(e); |
| 0 | 940 | | throw; |
| | 941 | | } |
| 2 | 942 | | } |
| | 943 | |
|
| | 944 | | /// <summary> The operation to reapply a virtual machine's state. </summary> |
| | 945 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 946 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 947 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 948 | | public virtual async Task<VirtualMachinesReapplyOperation> StartReapplyAsync(string resourceGroupName, string vm |
| | 949 | | { |
| 4 | 950 | | if (resourceGroupName == null) |
| | 951 | | { |
| 0 | 952 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 953 | | } |
| 4 | 954 | | if (vmName == null) |
| | 955 | | { |
| 0 | 956 | | throw new ArgumentNullException(nameof(vmName)); |
| | 957 | | } |
| | 958 | |
|
| 4 | 959 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartReapply"); |
| 4 | 960 | | scope.Start(); |
| | 961 | | try |
| | 962 | | { |
| 4 | 963 | | var originalResponse = await RestClient.ReapplyAsync(resourceGroupName, vmName, cancellationToken).Confi |
| 4 | 964 | | return new VirtualMachinesReapplyOperation(_clientDiagnostics, _pipeline, RestClient.CreateReapplyReques |
| | 965 | | } |
| 0 | 966 | | catch (Exception e) |
| | 967 | | { |
| 0 | 968 | | scope.Failed(e); |
| 0 | 969 | | throw; |
| | 970 | | } |
| 4 | 971 | | } |
| | 972 | |
|
| | 973 | | /// <summary> The operation to reapply a virtual machine's state. </summary> |
| | 974 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 975 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 976 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 977 | | public virtual VirtualMachinesReapplyOperation StartReapply(string resourceGroupName, string vmName, Cancellatio |
| | 978 | | { |
| 4 | 979 | | if (resourceGroupName == null) |
| | 980 | | { |
| 0 | 981 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 982 | | } |
| 4 | 983 | | if (vmName == null) |
| | 984 | | { |
| 0 | 985 | | throw new ArgumentNullException(nameof(vmName)); |
| | 986 | | } |
| | 987 | |
|
| 4 | 988 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartReapply"); |
| 4 | 989 | | scope.Start(); |
| | 990 | | try |
| | 991 | | { |
| 4 | 992 | | var originalResponse = RestClient.Reapply(resourceGroupName, vmName, cancellationToken); |
| 4 | 993 | | return new VirtualMachinesReapplyOperation(_clientDiagnostics, _pipeline, RestClient.CreateReapplyReques |
| | 994 | | } |
| 0 | 995 | | catch (Exception e) |
| | 996 | | { |
| 0 | 997 | | scope.Failed(e); |
| 0 | 998 | | throw; |
| | 999 | | } |
| 4 | 1000 | | } |
| | 1001 | |
|
| | 1002 | | /// <summary> The operation to restart a virtual machine. </summary> |
| | 1003 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1004 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 1005 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1006 | | public virtual async Task<VirtualMachinesRestartOperation> StartRestartAsync(string resourceGroupName, string vm |
| | 1007 | | { |
| 0 | 1008 | | if (resourceGroupName == null) |
| | 1009 | | { |
| 0 | 1010 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1011 | | } |
| 0 | 1012 | | if (vmName == null) |
| | 1013 | | { |
| 0 | 1014 | | throw new ArgumentNullException(nameof(vmName)); |
| | 1015 | | } |
| | 1016 | |
|
| 0 | 1017 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartRestart"); |
| 0 | 1018 | | scope.Start(); |
| | 1019 | | try |
| | 1020 | | { |
| 0 | 1021 | | var originalResponse = await RestClient.RestartAsync(resourceGroupName, vmName, cancellationToken).Confi |
| 0 | 1022 | | return new VirtualMachinesRestartOperation(_clientDiagnostics, _pipeline, RestClient.CreateRestartReques |
| | 1023 | | } |
| 0 | 1024 | | catch (Exception e) |
| | 1025 | | { |
| 0 | 1026 | | scope.Failed(e); |
| 0 | 1027 | | throw; |
| | 1028 | | } |
| 0 | 1029 | | } |
| | 1030 | |
|
| | 1031 | | /// <summary> The operation to restart a virtual machine. </summary> |
| | 1032 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1033 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 1034 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1035 | | public virtual VirtualMachinesRestartOperation StartRestart(string resourceGroupName, string vmName, Cancellatio |
| | 1036 | | { |
| 0 | 1037 | | if (resourceGroupName == null) |
| | 1038 | | { |
| 0 | 1039 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1040 | | } |
| 0 | 1041 | | if (vmName == null) |
| | 1042 | | { |
| 0 | 1043 | | throw new ArgumentNullException(nameof(vmName)); |
| | 1044 | | } |
| | 1045 | |
|
| 0 | 1046 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartRestart"); |
| 0 | 1047 | | scope.Start(); |
| | 1048 | | try |
| | 1049 | | { |
| 0 | 1050 | | var originalResponse = RestClient.Restart(resourceGroupName, vmName, cancellationToken); |
| 0 | 1051 | | return new VirtualMachinesRestartOperation(_clientDiagnostics, _pipeline, RestClient.CreateRestartReques |
| | 1052 | | } |
| 0 | 1053 | | catch (Exception e) |
| | 1054 | | { |
| 0 | 1055 | | scope.Failed(e); |
| 0 | 1056 | | throw; |
| | 1057 | | } |
| 0 | 1058 | | } |
| | 1059 | |
|
| | 1060 | | /// <summary> The operation to start a virtual machine. </summary> |
| | 1061 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1062 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 1063 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1064 | | public virtual async Task<VirtualMachinesStartOperation> StartStartAsync(string resourceGroupName, string vmName |
| | 1065 | | { |
| 4 | 1066 | | if (resourceGroupName == null) |
| | 1067 | | { |
| 0 | 1068 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1069 | | } |
| 4 | 1070 | | if (vmName == null) |
| | 1071 | | { |
| 0 | 1072 | | throw new ArgumentNullException(nameof(vmName)); |
| | 1073 | | } |
| | 1074 | |
|
| 4 | 1075 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartStart"); |
| 4 | 1076 | | scope.Start(); |
| | 1077 | | try |
| | 1078 | | { |
| 4 | 1079 | | var originalResponse = await RestClient.StartAsync(resourceGroupName, vmName, cancellationToken).Configu |
| 4 | 1080 | | return new VirtualMachinesStartOperation(_clientDiagnostics, _pipeline, RestClient.CreateStartRequest(re |
| | 1081 | | } |
| 0 | 1082 | | catch (Exception e) |
| | 1083 | | { |
| 0 | 1084 | | scope.Failed(e); |
| 0 | 1085 | | throw; |
| | 1086 | | } |
| 4 | 1087 | | } |
| | 1088 | |
|
| | 1089 | | /// <summary> The operation to start a virtual machine. </summary> |
| | 1090 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1091 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 1092 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1093 | | public virtual VirtualMachinesStartOperation StartStart(string resourceGroupName, string vmName, CancellationTok |
| | 1094 | | { |
| 4 | 1095 | | if (resourceGroupName == null) |
| | 1096 | | { |
| 0 | 1097 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1098 | | } |
| 4 | 1099 | | if (vmName == null) |
| | 1100 | | { |
| 0 | 1101 | | throw new ArgumentNullException(nameof(vmName)); |
| | 1102 | | } |
| | 1103 | |
|
| 4 | 1104 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartStart"); |
| 4 | 1105 | | scope.Start(); |
| | 1106 | | try |
| | 1107 | | { |
| 4 | 1108 | | var originalResponse = RestClient.Start(resourceGroupName, vmName, cancellationToken); |
| 4 | 1109 | | return new VirtualMachinesStartOperation(_clientDiagnostics, _pipeline, RestClient.CreateStartRequest(re |
| | 1110 | | } |
| 0 | 1111 | | catch (Exception e) |
| | 1112 | | { |
| 0 | 1113 | | scope.Failed(e); |
| 0 | 1114 | | throw; |
| | 1115 | | } |
| 4 | 1116 | | } |
| | 1117 | |
|
| | 1118 | | /// <summary> Shuts down the virtual machine, moves it to a new node, and powers it back on. </summary> |
| | 1119 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1120 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 1121 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1122 | | public virtual async Task<VirtualMachinesRedeployOperation> StartRedeployAsync(string resourceGroupName, string |
| | 1123 | | { |
| 4 | 1124 | | if (resourceGroupName == null) |
| | 1125 | | { |
| 0 | 1126 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1127 | | } |
| 4 | 1128 | | if (vmName == null) |
| | 1129 | | { |
| 0 | 1130 | | throw new ArgumentNullException(nameof(vmName)); |
| | 1131 | | } |
| | 1132 | |
|
| 4 | 1133 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartRedeploy"); |
| 4 | 1134 | | scope.Start(); |
| | 1135 | | try |
| | 1136 | | { |
| 4 | 1137 | | var originalResponse = await RestClient.RedeployAsync(resourceGroupName, vmName, cancellationToken).Conf |
| 4 | 1138 | | return new VirtualMachinesRedeployOperation(_clientDiagnostics, _pipeline, RestClient.CreateRedeployRequ |
| | 1139 | | } |
| 0 | 1140 | | catch (Exception e) |
| | 1141 | | { |
| 0 | 1142 | | scope.Failed(e); |
| 0 | 1143 | | throw; |
| | 1144 | | } |
| 4 | 1145 | | } |
| | 1146 | |
|
| | 1147 | | /// <summary> Shuts down the virtual machine, moves it to a new node, and powers it back on. </summary> |
| | 1148 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1149 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 1150 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1151 | | public virtual VirtualMachinesRedeployOperation StartRedeploy(string resourceGroupName, string vmName, Cancellat |
| | 1152 | | { |
| 4 | 1153 | | if (resourceGroupName == null) |
| | 1154 | | { |
| 0 | 1155 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1156 | | } |
| 4 | 1157 | | if (vmName == null) |
| | 1158 | | { |
| 0 | 1159 | | throw new ArgumentNullException(nameof(vmName)); |
| | 1160 | | } |
| | 1161 | |
|
| 4 | 1162 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartRedeploy"); |
| 4 | 1163 | | scope.Start(); |
| | 1164 | | try |
| | 1165 | | { |
| 4 | 1166 | | var originalResponse = RestClient.Redeploy(resourceGroupName, vmName, cancellationToken); |
| 4 | 1167 | | return new VirtualMachinesRedeployOperation(_clientDiagnostics, _pipeline, RestClient.CreateRedeployRequ |
| | 1168 | | } |
| 0 | 1169 | | catch (Exception e) |
| | 1170 | | { |
| 0 | 1171 | | scope.Failed(e); |
| 0 | 1172 | | throw; |
| | 1173 | | } |
| 4 | 1174 | | } |
| | 1175 | |
|
| | 1176 | | /// <summary> Reimages the virtual machine which has an ephemeral OS disk back to its initial state. </summary> |
| | 1177 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1178 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 1179 | | /// <param name="parameters"> Parameters supplied to the Reimage Virtual Machine operation. </param> |
| | 1180 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1181 | | public virtual async Task<VirtualMachinesReimageOperation> StartReimageAsync(string resourceGroupName, string vm |
| | 1182 | | { |
| 0 | 1183 | | if (resourceGroupName == null) |
| | 1184 | | { |
| 0 | 1185 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1186 | | } |
| 0 | 1187 | | if (vmName == null) |
| | 1188 | | { |
| 0 | 1189 | | throw new ArgumentNullException(nameof(vmName)); |
| | 1190 | | } |
| | 1191 | |
|
| 0 | 1192 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartReimage"); |
| 0 | 1193 | | scope.Start(); |
| | 1194 | | try |
| | 1195 | | { |
| 0 | 1196 | | var originalResponse = await RestClient.ReimageAsync(resourceGroupName, vmName, parameters, cancellation |
| 0 | 1197 | | return new VirtualMachinesReimageOperation(_clientDiagnostics, _pipeline, RestClient.CreateReimageReques |
| | 1198 | | } |
| 0 | 1199 | | catch (Exception e) |
| | 1200 | | { |
| 0 | 1201 | | scope.Failed(e); |
| 0 | 1202 | | throw; |
| | 1203 | | } |
| 0 | 1204 | | } |
| | 1205 | |
|
| | 1206 | | /// <summary> Reimages the virtual machine which has an ephemeral OS disk back to its initial state. </summary> |
| | 1207 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1208 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 1209 | | /// <param name="parameters"> Parameters supplied to the Reimage Virtual Machine operation. </param> |
| | 1210 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1211 | | public virtual VirtualMachinesReimageOperation StartReimage(string resourceGroupName, string vmName, VirtualMach |
| | 1212 | | { |
| 0 | 1213 | | if (resourceGroupName == null) |
| | 1214 | | { |
| 0 | 1215 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1216 | | } |
| 0 | 1217 | | if (vmName == null) |
| | 1218 | | { |
| 0 | 1219 | | throw new ArgumentNullException(nameof(vmName)); |
| | 1220 | | } |
| | 1221 | |
|
| 0 | 1222 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartReimage"); |
| 0 | 1223 | | scope.Start(); |
| | 1224 | | try |
| | 1225 | | { |
| 0 | 1226 | | var originalResponse = RestClient.Reimage(resourceGroupName, vmName, parameters, cancellationToken); |
| 0 | 1227 | | return new VirtualMachinesReimageOperation(_clientDiagnostics, _pipeline, RestClient.CreateReimageReques |
| | 1228 | | } |
| 0 | 1229 | | catch (Exception e) |
| | 1230 | | { |
| 0 | 1231 | | scope.Failed(e); |
| 0 | 1232 | | throw; |
| | 1233 | | } |
| 0 | 1234 | | } |
| | 1235 | |
|
| | 1236 | | /// <summary> The operation to perform maintenance on a virtual machine. </summary> |
| | 1237 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1238 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 1239 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1240 | | public virtual async Task<VirtualMachinesPerformMaintenanceOperation> StartPerformMaintenanceAsync(string resour |
| | 1241 | | { |
| 2 | 1242 | | if (resourceGroupName == null) |
| | 1243 | | { |
| 0 | 1244 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1245 | | } |
| 2 | 1246 | | if (vmName == null) |
| | 1247 | | { |
| 0 | 1248 | | throw new ArgumentNullException(nameof(vmName)); |
| | 1249 | | } |
| | 1250 | |
|
| 2 | 1251 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartPerformMaintenance"); |
| 2 | 1252 | | scope.Start(); |
| | 1253 | | try |
| | 1254 | | { |
| 2 | 1255 | | var originalResponse = await RestClient.PerformMaintenanceAsync(resourceGroupName, vmName, cancellationT |
| 0 | 1256 | | return new VirtualMachinesPerformMaintenanceOperation(_clientDiagnostics, _pipeline, RestClient.CreatePe |
| | 1257 | | } |
| 2 | 1258 | | catch (Exception e) |
| | 1259 | | { |
| 2 | 1260 | | scope.Failed(e); |
| 2 | 1261 | | throw; |
| | 1262 | | } |
| 0 | 1263 | | } |
| | 1264 | |
|
| | 1265 | | /// <summary> The operation to perform maintenance on a virtual machine. </summary> |
| | 1266 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1267 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 1268 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1269 | | public virtual VirtualMachinesPerformMaintenanceOperation StartPerformMaintenance(string resourceGroupName, stri |
| | 1270 | | { |
| 2 | 1271 | | if (resourceGroupName == null) |
| | 1272 | | { |
| 0 | 1273 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1274 | | } |
| 2 | 1275 | | if (vmName == null) |
| | 1276 | | { |
| 0 | 1277 | | throw new ArgumentNullException(nameof(vmName)); |
| | 1278 | | } |
| | 1279 | |
|
| 2 | 1280 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartPerformMaintenance"); |
| 2 | 1281 | | scope.Start(); |
| | 1282 | | try |
| | 1283 | | { |
| 2 | 1284 | | var originalResponse = RestClient.PerformMaintenance(resourceGroupName, vmName, cancellationToken); |
| 0 | 1285 | | return new VirtualMachinesPerformMaintenanceOperation(_clientDiagnostics, _pipeline, RestClient.CreatePe |
| | 1286 | | } |
| 2 | 1287 | | catch (Exception e) |
| | 1288 | | { |
| 2 | 1289 | | scope.Failed(e); |
| 2 | 1290 | | throw; |
| | 1291 | | } |
| 0 | 1292 | | } |
| | 1293 | |
|
| | 1294 | | /// <summary> Run command on the VM. </summary> |
| | 1295 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1296 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 1297 | | /// <param name="parameters"> Parameters supplied to the Run command operation. </param> |
| | 1298 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1299 | | public virtual async Task<VirtualMachinesRunCommandOperation> StartRunCommandAsync(string resourceGroupName, str |
| | 1300 | | { |
| 0 | 1301 | | if (resourceGroupName == null) |
| | 1302 | | { |
| 0 | 1303 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1304 | | } |
| 0 | 1305 | | if (vmName == null) |
| | 1306 | | { |
| 0 | 1307 | | throw new ArgumentNullException(nameof(vmName)); |
| | 1308 | | } |
| 0 | 1309 | | if (parameters == null) |
| | 1310 | | { |
| 0 | 1311 | | throw new ArgumentNullException(nameof(parameters)); |
| | 1312 | | } |
| | 1313 | |
|
| 0 | 1314 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartRunCommand"); |
| 0 | 1315 | | scope.Start(); |
| | 1316 | | try |
| | 1317 | | { |
| 0 | 1318 | | var originalResponse = await RestClient.RunCommandAsync(resourceGroupName, vmName, parameters, cancellat |
| 0 | 1319 | | return new VirtualMachinesRunCommandOperation(_clientDiagnostics, _pipeline, RestClient.CreateRunCommand |
| | 1320 | | } |
| 0 | 1321 | | catch (Exception e) |
| | 1322 | | { |
| 0 | 1323 | | scope.Failed(e); |
| 0 | 1324 | | throw; |
| | 1325 | | } |
| 0 | 1326 | | } |
| | 1327 | |
|
| | 1328 | | /// <summary> Run command on the VM. </summary> |
| | 1329 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1330 | | /// <param name="vmName"> The name of the virtual machine. </param> |
| | 1331 | | /// <param name="parameters"> Parameters supplied to the Run command operation. </param> |
| | 1332 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1333 | | public virtual VirtualMachinesRunCommandOperation StartRunCommand(string resourceGroupName, string vmName, RunCo |
| | 1334 | | { |
| 0 | 1335 | | if (resourceGroupName == null) |
| | 1336 | | { |
| 0 | 1337 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1338 | | } |
| 0 | 1339 | | if (vmName == null) |
| | 1340 | | { |
| 0 | 1341 | | throw new ArgumentNullException(nameof(vmName)); |
| | 1342 | | } |
| 0 | 1343 | | if (parameters == null) |
| | 1344 | | { |
| 0 | 1345 | | throw new ArgumentNullException(nameof(parameters)); |
| | 1346 | | } |
| | 1347 | |
|
| 0 | 1348 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachinesOperations.StartRunCommand"); |
| 0 | 1349 | | scope.Start(); |
| | 1350 | | try |
| | 1351 | | { |
| 0 | 1352 | | var originalResponse = RestClient.RunCommand(resourceGroupName, vmName, parameters, cancellationToken); |
| 0 | 1353 | | return new VirtualMachinesRunCommandOperation(_clientDiagnostics, _pipeline, RestClient.CreateRunCommand |
| | 1354 | | } |
| 0 | 1355 | | catch (Exception e) |
| | 1356 | | { |
| 0 | 1357 | | scope.Failed(e); |
| 0 | 1358 | | throw; |
| | 1359 | | } |
| 0 | 1360 | | } |
| | 1361 | | } |
| | 1362 | | } |