| | 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 VirtualMachineScaleSetExtensions service client. </summary> |
| | 19 | | public partial class VirtualMachineScaleSetExtensionsOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 32 | 23 | | internal VirtualMachineScaleSetExtensionsRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of VirtualMachineScaleSetExtensionsOperations for mocking. </summary> |
| 396 | 25 | | protected VirtualMachineScaleSetExtensionsOperations() |
| | 26 | | { |
| 396 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of VirtualMachineScaleSetExtensionsOperations. </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 VirtualMachineScaleSetExtensionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, |
| | 34 | | { |
| 396 | 35 | | RestClient = new VirtualMachineScaleSetExtensionsRestOperations(clientDiagnostics, pipeline, subscriptionId, |
| 396 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 396 | 37 | | _pipeline = pipeline; |
| 396 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> The operation to get the extension. </summary> |
| | 41 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 42 | | /// <param name="vmScaleSetName"> The name of the VM scale set containing the extension. </param> |
| | 43 | | /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param> |
| | 44 | | /// <param name="expand"> The expand expression to apply on the operation. </param> |
| | 45 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 46 | | public virtual async Task<Response<VirtualMachineScaleSetExtension>> GetAsync(string resourceGroupName, string v |
| | 47 | | { |
| 6 | 48 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.Get"); |
| 6 | 49 | | scope.Start(); |
| | 50 | | try |
| | 51 | | { |
| 6 | 52 | | return await RestClient.GetAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, expand, cancellat |
| | 53 | | } |
| 0 | 54 | | catch (Exception e) |
| | 55 | | { |
| 0 | 56 | | scope.Failed(e); |
| 0 | 57 | | throw; |
| | 58 | | } |
| 6 | 59 | | } |
| | 60 | |
|
| | 61 | | /// <summary> The operation to get the extension. </summary> |
| | 62 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 63 | | /// <param name="vmScaleSetName"> The name of the VM scale set containing the extension. </param> |
| | 64 | | /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param> |
| | 65 | | /// <param name="expand"> The expand expression to apply on the operation. </param> |
| | 66 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 67 | | public virtual Response<VirtualMachineScaleSetExtension> Get(string resourceGroupName, string vmScaleSetName, st |
| | 68 | | { |
| 6 | 69 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.Get"); |
| 6 | 70 | | scope.Start(); |
| | 71 | | try |
| | 72 | | { |
| 6 | 73 | | return RestClient.Get(resourceGroupName, vmScaleSetName, vmssExtensionName, expand, cancellationToken); |
| | 74 | | } |
| 0 | 75 | | catch (Exception e) |
| | 76 | | { |
| 0 | 77 | | scope.Failed(e); |
| 0 | 78 | | throw; |
| | 79 | | } |
| 6 | 80 | | } |
| | 81 | |
|
| | 82 | | /// <summary> Gets a list of all extensions in a VM scale set. </summary> |
| | 83 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 84 | | /// <param name="vmScaleSetName"> The name of the VM scale set containing the extension. </param> |
| | 85 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 86 | | public virtual AsyncPageable<VirtualMachineScaleSetExtension> ListAsync(string resourceGroupName, string vmScale |
| | 87 | | { |
| 2 | 88 | | if (resourceGroupName == null) |
| | 89 | | { |
| 0 | 90 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 91 | | } |
| 2 | 92 | | if (vmScaleSetName == null) |
| | 93 | | { |
| 0 | 94 | | throw new ArgumentNullException(nameof(vmScaleSetName)); |
| | 95 | | } |
| | 96 | |
|
| | 97 | | async Task<Page<VirtualMachineScaleSetExtension>> FirstPageFunc(int? pageSizeHint) |
| | 98 | | { |
| 2 | 99 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.List"); |
| 2 | 100 | | scope.Start(); |
| | 101 | | try |
| | 102 | | { |
| 2 | 103 | | var response = await RestClient.ListAsync(resourceGroupName, vmScaleSetName, cancellationToken).Conf |
| 2 | 104 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 105 | | } |
| 0 | 106 | | catch (Exception e) |
| | 107 | | { |
| 0 | 108 | | scope.Failed(e); |
| 0 | 109 | | throw; |
| | 110 | | } |
| 2 | 111 | | } |
| | 112 | | async Task<Page<VirtualMachineScaleSetExtension>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 113 | | { |
| 0 | 114 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.List"); |
| 0 | 115 | | scope.Start(); |
| | 116 | | try |
| | 117 | | { |
| 0 | 118 | | var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, vmScaleSetName, cance |
| 0 | 119 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 120 | | } |
| 0 | 121 | | catch (Exception e) |
| | 122 | | { |
| 0 | 123 | | scope.Failed(e); |
| 0 | 124 | | throw; |
| | 125 | | } |
| 0 | 126 | | } |
| 2 | 127 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 128 | | } |
| | 129 | |
|
| | 130 | | /// <summary> Gets a list of all extensions in a VM scale set. </summary> |
| | 131 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 132 | | /// <param name="vmScaleSetName"> The name of the VM scale set containing the extension. </param> |
| | 133 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 134 | | public virtual Pageable<VirtualMachineScaleSetExtension> List(string resourceGroupName, string vmScaleSetName, C |
| | 135 | | { |
| 2 | 136 | | if (resourceGroupName == null) |
| | 137 | | { |
| 0 | 138 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 139 | | } |
| 2 | 140 | | if (vmScaleSetName == null) |
| | 141 | | { |
| 0 | 142 | | throw new ArgumentNullException(nameof(vmScaleSetName)); |
| | 143 | | } |
| | 144 | |
|
| | 145 | | Page<VirtualMachineScaleSetExtension> FirstPageFunc(int? pageSizeHint) |
| | 146 | | { |
| 2 | 147 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.List"); |
| 2 | 148 | | scope.Start(); |
| | 149 | | try |
| | 150 | | { |
| 2 | 151 | | var response = RestClient.List(resourceGroupName, vmScaleSetName, cancellationToken); |
| 2 | 152 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 153 | | } |
| 0 | 154 | | catch (Exception e) |
| | 155 | | { |
| 0 | 156 | | scope.Failed(e); |
| 0 | 157 | | throw; |
| | 158 | | } |
| 2 | 159 | | } |
| | 160 | | Page<VirtualMachineScaleSetExtension> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 161 | | { |
| 0 | 162 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.List"); |
| 0 | 163 | | scope.Start(); |
| | 164 | | try |
| | 165 | | { |
| 0 | 166 | | var response = RestClient.ListNextPage(nextLink, resourceGroupName, vmScaleSetName, cancellationToke |
| 0 | 167 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 168 | | } |
| 0 | 169 | | catch (Exception e) |
| | 170 | | { |
| 0 | 171 | | scope.Failed(e); |
| 0 | 172 | | throw; |
| | 173 | | } |
| 0 | 174 | | } |
| 2 | 175 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 176 | | } |
| | 177 | |
|
| | 178 | | /// <summary> The operation to create or update an extension. </summary> |
| | 179 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 180 | | /// <param name="vmScaleSetName"> The name of the VM scale set where the extension should be create or updated. |
| | 181 | | /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param> |
| | 182 | | /// <param name="extensionParameters"> Parameters supplied to the Create VM scale set Extension operation. </par |
| | 183 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 184 | | public virtual async Task<VirtualMachineScaleSetExtensionsCreateOrUpdateOperation> StartCreateOrUpdateAsync(stri |
| | 185 | | { |
| 4 | 186 | | if (resourceGroupName == null) |
| | 187 | | { |
| 0 | 188 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 189 | | } |
| 4 | 190 | | if (vmScaleSetName == null) |
| | 191 | | { |
| 0 | 192 | | throw new ArgumentNullException(nameof(vmScaleSetName)); |
| | 193 | | } |
| 4 | 194 | | if (vmssExtensionName == null) |
| | 195 | | { |
| 0 | 196 | | throw new ArgumentNullException(nameof(vmssExtensionName)); |
| | 197 | | } |
| 4 | 198 | | if (extensionParameters == null) |
| | 199 | | { |
| 0 | 200 | | throw new ArgumentNullException(nameof(extensionParameters)); |
| | 201 | | } |
| | 202 | |
|
| 4 | 203 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.StartCreateOrUp |
| 4 | 204 | | scope.Start(); |
| | 205 | | try |
| | 206 | | { |
| 4 | 207 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, vmScaleSetName, vmssExten |
| 4 | 208 | | return new VirtualMachineScaleSetExtensionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestCl |
| | 209 | | } |
| 0 | 210 | | catch (Exception e) |
| | 211 | | { |
| 0 | 212 | | scope.Failed(e); |
| 0 | 213 | | throw; |
| | 214 | | } |
| 4 | 215 | | } |
| | 216 | |
|
| | 217 | | /// <summary> The operation to create or update an extension. </summary> |
| | 218 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 219 | | /// <param name="vmScaleSetName"> The name of the VM scale set where the extension should be create or updated. |
| | 220 | | /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param> |
| | 221 | | /// <param name="extensionParameters"> Parameters supplied to the Create VM scale set Extension operation. </par |
| | 222 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 223 | | public virtual VirtualMachineScaleSetExtensionsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupN |
| | 224 | | { |
| 4 | 225 | | if (resourceGroupName == null) |
| | 226 | | { |
| 0 | 227 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 228 | | } |
| 4 | 229 | | if (vmScaleSetName == null) |
| | 230 | | { |
| 0 | 231 | | throw new ArgumentNullException(nameof(vmScaleSetName)); |
| | 232 | | } |
| 4 | 233 | | if (vmssExtensionName == null) |
| | 234 | | { |
| 0 | 235 | | throw new ArgumentNullException(nameof(vmssExtensionName)); |
| | 236 | | } |
| 4 | 237 | | if (extensionParameters == null) |
| | 238 | | { |
| 0 | 239 | | throw new ArgumentNullException(nameof(extensionParameters)); |
| | 240 | | } |
| | 241 | |
|
| 4 | 242 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.StartCreateOrUp |
| 4 | 243 | | scope.Start(); |
| | 244 | | try |
| | 245 | | { |
| 4 | 246 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, vmScaleSetName, vmssExtensionName, e |
| 4 | 247 | | return new VirtualMachineScaleSetExtensionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestCl |
| | 248 | | } |
| 0 | 249 | | catch (Exception e) |
| | 250 | | { |
| 0 | 251 | | scope.Failed(e); |
| 0 | 252 | | throw; |
| | 253 | | } |
| 4 | 254 | | } |
| | 255 | |
|
| | 256 | | /// <summary> The operation to update an extension. </summary> |
| | 257 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 258 | | /// <param name="vmScaleSetName"> The name of the VM scale set where the extension should be updated. </param> |
| | 259 | | /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param> |
| | 260 | | /// <param name="extensionParameters"> Parameters supplied to the Update VM scale set Extension operation. </par |
| | 261 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 262 | | public virtual async Task<VirtualMachineScaleSetExtensionsUpdateOperation> StartUpdateAsync(string resourceGroup |
| | 263 | | { |
| 0 | 264 | | if (resourceGroupName == null) |
| | 265 | | { |
| 0 | 266 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 267 | | } |
| 0 | 268 | | if (vmScaleSetName == null) |
| | 269 | | { |
| 0 | 270 | | throw new ArgumentNullException(nameof(vmScaleSetName)); |
| | 271 | | } |
| 0 | 272 | | if (vmssExtensionName == null) |
| | 273 | | { |
| 0 | 274 | | throw new ArgumentNullException(nameof(vmssExtensionName)); |
| | 275 | | } |
| 0 | 276 | | if (extensionParameters == null) |
| | 277 | | { |
| 0 | 278 | | throw new ArgumentNullException(nameof(extensionParameters)); |
| | 279 | | } |
| | 280 | |
|
| 0 | 281 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.StartUpdate"); |
| 0 | 282 | | scope.Start(); |
| | 283 | | try |
| | 284 | | { |
| 0 | 285 | | var originalResponse = await RestClient.UpdateAsync(resourceGroupName, vmScaleSetName, vmssExtensionName |
| 0 | 286 | | return new VirtualMachineScaleSetExtensionsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.Cre |
| | 287 | | } |
| 0 | 288 | | catch (Exception e) |
| | 289 | | { |
| 0 | 290 | | scope.Failed(e); |
| 0 | 291 | | throw; |
| | 292 | | } |
| 0 | 293 | | } |
| | 294 | |
|
| | 295 | | /// <summary> The operation to update an extension. </summary> |
| | 296 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 297 | | /// <param name="vmScaleSetName"> The name of the VM scale set where the extension should be updated. </param> |
| | 298 | | /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param> |
| | 299 | | /// <param name="extensionParameters"> Parameters supplied to the Update VM scale set Extension operation. </par |
| | 300 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 301 | | public virtual VirtualMachineScaleSetExtensionsUpdateOperation StartUpdate(string resourceGroupName, string vmSc |
| | 302 | | { |
| 0 | 303 | | if (resourceGroupName == null) |
| | 304 | | { |
| 0 | 305 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 306 | | } |
| 0 | 307 | | if (vmScaleSetName == null) |
| | 308 | | { |
| 0 | 309 | | throw new ArgumentNullException(nameof(vmScaleSetName)); |
| | 310 | | } |
| 0 | 311 | | if (vmssExtensionName == null) |
| | 312 | | { |
| 0 | 313 | | throw new ArgumentNullException(nameof(vmssExtensionName)); |
| | 314 | | } |
| 0 | 315 | | if (extensionParameters == null) |
| | 316 | | { |
| 0 | 317 | | throw new ArgumentNullException(nameof(extensionParameters)); |
| | 318 | | } |
| | 319 | |
|
| 0 | 320 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.StartUpdate"); |
| 0 | 321 | | scope.Start(); |
| | 322 | | try |
| | 323 | | { |
| 0 | 324 | | var originalResponse = RestClient.Update(resourceGroupName, vmScaleSetName, vmssExtensionName, extension |
| 0 | 325 | | return new VirtualMachineScaleSetExtensionsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.Cre |
| | 326 | | } |
| 0 | 327 | | catch (Exception e) |
| | 328 | | { |
| 0 | 329 | | scope.Failed(e); |
| 0 | 330 | | throw; |
| | 331 | | } |
| 0 | 332 | | } |
| | 333 | |
|
| | 334 | | /// <summary> The operation to delete the extension. </summary> |
| | 335 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 336 | | /// <param name="vmScaleSetName"> The name of the VM scale set where the extension should be deleted. </param> |
| | 337 | | /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param> |
| | 338 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 339 | | public virtual async Task<VirtualMachineScaleSetExtensionsDeleteOperation> StartDeleteAsync(string resourceGroup |
| | 340 | | { |
| 0 | 341 | | if (resourceGroupName == null) |
| | 342 | | { |
| 0 | 343 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 344 | | } |
| 0 | 345 | | if (vmScaleSetName == null) |
| | 346 | | { |
| 0 | 347 | | throw new ArgumentNullException(nameof(vmScaleSetName)); |
| | 348 | | } |
| 0 | 349 | | if (vmssExtensionName == null) |
| | 350 | | { |
| 0 | 351 | | throw new ArgumentNullException(nameof(vmssExtensionName)); |
| | 352 | | } |
| | 353 | |
|
| 0 | 354 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.StartDelete"); |
| 0 | 355 | | scope.Start(); |
| | 356 | | try |
| | 357 | | { |
| 0 | 358 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, vmScaleSetName, vmssExtensionName |
| 0 | 359 | | return new VirtualMachineScaleSetExtensionsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.Cre |
| | 360 | | } |
| 0 | 361 | | catch (Exception e) |
| | 362 | | { |
| 0 | 363 | | scope.Failed(e); |
| 0 | 364 | | throw; |
| | 365 | | } |
| 0 | 366 | | } |
| | 367 | |
|
| | 368 | | /// <summary> The operation to delete the extension. </summary> |
| | 369 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 370 | | /// <param name="vmScaleSetName"> The name of the VM scale set where the extension should be deleted. </param> |
| | 371 | | /// <param name="vmssExtensionName"> The name of the VM scale set extension. </param> |
| | 372 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 373 | | public virtual VirtualMachineScaleSetExtensionsDeleteOperation StartDelete(string resourceGroupName, string vmSc |
| | 374 | | { |
| 0 | 375 | | if (resourceGroupName == null) |
| | 376 | | { |
| 0 | 377 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 378 | | } |
| 0 | 379 | | if (vmScaleSetName == null) |
| | 380 | | { |
| 0 | 381 | | throw new ArgumentNullException(nameof(vmScaleSetName)); |
| | 382 | | } |
| 0 | 383 | | if (vmssExtensionName == null) |
| | 384 | | { |
| 0 | 385 | | throw new ArgumentNullException(nameof(vmssExtensionName)); |
| | 386 | | } |
| | 387 | |
|
| 0 | 388 | | using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetExtensionsOperations.StartDelete"); |
| 0 | 389 | | scope.Start(); |
| | 390 | | try |
| | 391 | | { |
| 0 | 392 | | var originalResponse = RestClient.Delete(resourceGroupName, vmScaleSetName, vmssExtensionName, cancellat |
| 0 | 393 | | return new VirtualMachineScaleSetExtensionsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.Cre |
| | 394 | | } |
| 0 | 395 | | catch (Exception e) |
| | 396 | | { |
| 0 | 397 | | scope.Failed(e); |
| 0 | 398 | | throw; |
| | 399 | | } |
| 0 | 400 | | } |
| | 401 | | } |
| | 402 | | } |