| | 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.Network.Models; |
| | 15 | |
|
| | 16 | | namespace Azure.ResourceManager.Network |
| | 17 | | { |
| | 18 | | /// <summary> The PacketCaptures service client. </summary> |
| | 19 | | public partial class PacketCapturesOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 56 | 23 | | internal PacketCapturesRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of PacketCapturesOperations for mocking. </summary> |
| 36 | 25 | | protected PacketCapturesOperations() |
| | 26 | | { |
| 36 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of PacketCapturesOperations. </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"> The subscription credentials which uniquely identify the Microsoft Azure subsc |
| | 32 | | /// <param name="endpoint"> server parameter. </param> |
| 36 | 33 | | internal PacketCapturesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptio |
| | 34 | | { |
| 36 | 35 | | RestClient = new PacketCapturesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 36 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 36 | 37 | | _pipeline = pipeline; |
| 36 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Gets a packet capture session by name. </summary> |
| | 41 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 42 | | /// <param name="networkWatcherName"> The name of the network watcher. </param> |
| | 43 | | /// <param name="packetCaptureName"> The name of the packet capture session. </param> |
| | 44 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 45 | | public virtual async Task<Response<PacketCaptureResult>> GetAsync(string resourceGroupName, string networkWatche |
| | 46 | | { |
| 2 | 47 | | using var scope = _clientDiagnostics.CreateScope("PacketCapturesOperations.Get"); |
| 2 | 48 | | scope.Start(); |
| | 49 | | try |
| | 50 | | { |
| 2 | 51 | | return await RestClient.GetAsync(resourceGroupName, networkWatcherName, packetCaptureName, cancellationT |
| | 52 | | } |
| 0 | 53 | | catch (Exception e) |
| | 54 | | { |
| 0 | 55 | | scope.Failed(e); |
| 0 | 56 | | throw; |
| | 57 | | } |
| 2 | 58 | | } |
| | 59 | |
|
| | 60 | | /// <summary> Gets a packet capture session by name. </summary> |
| | 61 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 62 | | /// <param name="networkWatcherName"> The name of the network watcher. </param> |
| | 63 | | /// <param name="packetCaptureName"> The name of the packet capture session. </param> |
| | 64 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 65 | | public virtual Response<PacketCaptureResult> Get(string resourceGroupName, string networkWatcherName, string pac |
| | 66 | | { |
| 2 | 67 | | using var scope = _clientDiagnostics.CreateScope("PacketCapturesOperations.Get"); |
| 2 | 68 | | scope.Start(); |
| | 69 | | try |
| | 70 | | { |
| 2 | 71 | | return RestClient.Get(resourceGroupName, networkWatcherName, packetCaptureName, cancellationToken); |
| | 72 | | } |
| 0 | 73 | | catch (Exception e) |
| | 74 | | { |
| 0 | 75 | | scope.Failed(e); |
| 0 | 76 | | throw; |
| | 77 | | } |
| 2 | 78 | | } |
| | 79 | |
|
| | 80 | | /// <summary> Lists all packet capture sessions within the specified resource group. </summary> |
| | 81 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 82 | | /// <param name="networkWatcherName"> The name of the Network Watcher resource. </param> |
| | 83 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 84 | | public virtual AsyncPageable<PacketCaptureResult> ListAsync(string resourceGroupName, string networkWatcherName, |
| | 85 | | { |
| 4 | 86 | | if (resourceGroupName == null) |
| | 87 | | { |
| 0 | 88 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 89 | | } |
| 4 | 90 | | if (networkWatcherName == null) |
| | 91 | | { |
| 0 | 92 | | throw new ArgumentNullException(nameof(networkWatcherName)); |
| | 93 | | } |
| | 94 | |
|
| | 95 | | async Task<Page<PacketCaptureResult>> FirstPageFunc(int? pageSizeHint) |
| | 96 | | { |
| 2 | 97 | | using var scope = _clientDiagnostics.CreateScope("PacketCapturesOperations.List"); |
| 2 | 98 | | scope.Start(); |
| | 99 | | try |
| | 100 | | { |
| 2 | 101 | | var response = await RestClient.ListAsync(resourceGroupName, networkWatcherName, cancellationToken). |
| 2 | 102 | | return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); |
| | 103 | | } |
| 0 | 104 | | catch (Exception e) |
| | 105 | | { |
| 0 | 106 | | scope.Failed(e); |
| 0 | 107 | | throw; |
| | 108 | | } |
| 2 | 109 | | } |
| 4 | 110 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); |
| | 111 | | } |
| | 112 | |
|
| | 113 | | /// <summary> Lists all packet capture sessions within the specified resource group. </summary> |
| | 114 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 115 | | /// <param name="networkWatcherName"> The name of the Network Watcher resource. </param> |
| | 116 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 117 | | public virtual Pageable<PacketCaptureResult> List(string resourceGroupName, string networkWatcherName, Cancellat |
| | 118 | | { |
| 4 | 119 | | if (resourceGroupName == null) |
| | 120 | | { |
| 0 | 121 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 122 | | } |
| 4 | 123 | | if (networkWatcherName == null) |
| | 124 | | { |
| 0 | 125 | | throw new ArgumentNullException(nameof(networkWatcherName)); |
| | 126 | | } |
| | 127 | |
|
| | 128 | | Page<PacketCaptureResult> FirstPageFunc(int? pageSizeHint) |
| | 129 | | { |
| 2 | 130 | | using var scope = _clientDiagnostics.CreateScope("PacketCapturesOperations.List"); |
| 2 | 131 | | scope.Start(); |
| | 132 | | try |
| | 133 | | { |
| 2 | 134 | | var response = RestClient.List(resourceGroupName, networkWatcherName, cancellationToken); |
| 2 | 135 | | return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); |
| | 136 | | } |
| 0 | 137 | | catch (Exception e) |
| | 138 | | { |
| 0 | 139 | | scope.Failed(e); |
| 0 | 140 | | throw; |
| | 141 | | } |
| 2 | 142 | | } |
| 4 | 143 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, null); |
| | 144 | | } |
| | 145 | |
|
| | 146 | | /// <summary> Create and start a packet capture on the specified VM. </summary> |
| | 147 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 148 | | /// <param name="networkWatcherName"> The name of the network watcher. </param> |
| | 149 | | /// <param name="packetCaptureName"> The name of the packet capture session. </param> |
| | 150 | | /// <param name="parameters"> Parameters that define the create packet capture operation. </param> |
| | 151 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 152 | | public virtual async Task<PacketCapturesCreateOperation> StartCreateAsync(string resourceGroupName, string netwo |
| | 153 | | { |
| 4 | 154 | | if (resourceGroupName == null) |
| | 155 | | { |
| 0 | 156 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 157 | | } |
| 4 | 158 | | if (networkWatcherName == null) |
| | 159 | | { |
| 0 | 160 | | throw new ArgumentNullException(nameof(networkWatcherName)); |
| | 161 | | } |
| 4 | 162 | | if (packetCaptureName == null) |
| | 163 | | { |
| 0 | 164 | | throw new ArgumentNullException(nameof(packetCaptureName)); |
| | 165 | | } |
| 4 | 166 | | if (parameters == null) |
| | 167 | | { |
| 0 | 168 | | throw new ArgumentNullException(nameof(parameters)); |
| | 169 | | } |
| | 170 | |
|
| 4 | 171 | | using var scope = _clientDiagnostics.CreateScope("PacketCapturesOperations.StartCreate"); |
| 4 | 172 | | scope.Start(); |
| | 173 | | try |
| | 174 | | { |
| 4 | 175 | | var originalResponse = await RestClient.CreateAsync(resourceGroupName, networkWatcherName, packetCapture |
| 4 | 176 | | return new PacketCapturesCreateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateRequest(r |
| | 177 | | } |
| 0 | 178 | | catch (Exception e) |
| | 179 | | { |
| 0 | 180 | | scope.Failed(e); |
| 0 | 181 | | throw; |
| | 182 | | } |
| 4 | 183 | | } |
| | 184 | |
|
| | 185 | | /// <summary> Create and start a packet capture on the specified VM. </summary> |
| | 186 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 187 | | /// <param name="networkWatcherName"> The name of the network watcher. </param> |
| | 188 | | /// <param name="packetCaptureName"> The name of the packet capture session. </param> |
| | 189 | | /// <param name="parameters"> Parameters that define the create packet capture operation. </param> |
| | 190 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 191 | | public virtual PacketCapturesCreateOperation StartCreate(string resourceGroupName, string networkWatcherName, st |
| | 192 | | { |
| 4 | 193 | | if (resourceGroupName == null) |
| | 194 | | { |
| 0 | 195 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 196 | | } |
| 4 | 197 | | if (networkWatcherName == null) |
| | 198 | | { |
| 0 | 199 | | throw new ArgumentNullException(nameof(networkWatcherName)); |
| | 200 | | } |
| 4 | 201 | | if (packetCaptureName == null) |
| | 202 | | { |
| 0 | 203 | | throw new ArgumentNullException(nameof(packetCaptureName)); |
| | 204 | | } |
| 4 | 205 | | if (parameters == null) |
| | 206 | | { |
| 0 | 207 | | throw new ArgumentNullException(nameof(parameters)); |
| | 208 | | } |
| | 209 | |
|
| 4 | 210 | | using var scope = _clientDiagnostics.CreateScope("PacketCapturesOperations.StartCreate"); |
| 4 | 211 | | scope.Start(); |
| | 212 | | try |
| | 213 | | { |
| 4 | 214 | | var originalResponse = RestClient.Create(resourceGroupName, networkWatcherName, packetCaptureName, param |
| 4 | 215 | | return new PacketCapturesCreateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateRequest(r |
| | 216 | | } |
| 0 | 217 | | catch (Exception e) |
| | 218 | | { |
| 0 | 219 | | scope.Failed(e); |
| 0 | 220 | | throw; |
| | 221 | | } |
| 4 | 222 | | } |
| | 223 | |
|
| | 224 | | /// <summary> Deletes the specified packet capture session. </summary> |
| | 225 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 226 | | /// <param name="networkWatcherName"> The name of the network watcher. </param> |
| | 227 | | /// <param name="packetCaptureName"> The name of the packet capture session. </param> |
| | 228 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 229 | | public virtual async Task<PacketCapturesDeleteOperation> StartDeleteAsync(string resourceGroupName, string netwo |
| | 230 | | { |
| 2 | 231 | | if (resourceGroupName == null) |
| | 232 | | { |
| 0 | 233 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 234 | | } |
| 2 | 235 | | if (networkWatcherName == null) |
| | 236 | | { |
| 0 | 237 | | throw new ArgumentNullException(nameof(networkWatcherName)); |
| | 238 | | } |
| 2 | 239 | | if (packetCaptureName == null) |
| | 240 | | { |
| 0 | 241 | | throw new ArgumentNullException(nameof(packetCaptureName)); |
| | 242 | | } |
| | 243 | |
|
| 2 | 244 | | using var scope = _clientDiagnostics.CreateScope("PacketCapturesOperations.StartDelete"); |
| 2 | 245 | | scope.Start(); |
| | 246 | | try |
| | 247 | | { |
| 2 | 248 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, networkWatcherName, packetCapture |
| 2 | 249 | | return new PacketCapturesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(r |
| | 250 | | } |
| 0 | 251 | | catch (Exception e) |
| | 252 | | { |
| 0 | 253 | | scope.Failed(e); |
| 0 | 254 | | throw; |
| | 255 | | } |
| 2 | 256 | | } |
| | 257 | |
|
| | 258 | | /// <summary> Deletes the specified packet capture session. </summary> |
| | 259 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 260 | | /// <param name="networkWatcherName"> The name of the network watcher. </param> |
| | 261 | | /// <param name="packetCaptureName"> The name of the packet capture session. </param> |
| | 262 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 263 | | public virtual PacketCapturesDeleteOperation StartDelete(string resourceGroupName, string networkWatcherName, st |
| | 264 | | { |
| 2 | 265 | | if (resourceGroupName == null) |
| | 266 | | { |
| 0 | 267 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 268 | | } |
| 2 | 269 | | if (networkWatcherName == null) |
| | 270 | | { |
| 0 | 271 | | throw new ArgumentNullException(nameof(networkWatcherName)); |
| | 272 | | } |
| 2 | 273 | | if (packetCaptureName == null) |
| | 274 | | { |
| 0 | 275 | | throw new ArgumentNullException(nameof(packetCaptureName)); |
| | 276 | | } |
| | 277 | |
|
| 2 | 278 | | using var scope = _clientDiagnostics.CreateScope("PacketCapturesOperations.StartDelete"); |
| 2 | 279 | | scope.Start(); |
| | 280 | | try |
| | 281 | | { |
| 2 | 282 | | var originalResponse = RestClient.Delete(resourceGroupName, networkWatcherName, packetCaptureName, cance |
| 2 | 283 | | return new PacketCapturesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(r |
| | 284 | | } |
| 0 | 285 | | catch (Exception e) |
| | 286 | | { |
| 0 | 287 | | scope.Failed(e); |
| 0 | 288 | | throw; |
| | 289 | | } |
| 2 | 290 | | } |
| | 291 | |
|
| | 292 | | /// <summary> Stops a specified packet capture session. </summary> |
| | 293 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 294 | | /// <param name="networkWatcherName"> The name of the network watcher. </param> |
| | 295 | | /// <param name="packetCaptureName"> The name of the packet capture session. </param> |
| | 296 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 297 | | public virtual async Task<PacketCapturesStopOperation> StartStopAsync(string resourceGroupName, string networkWa |
| | 298 | | { |
| 2 | 299 | | if (resourceGroupName == null) |
| | 300 | | { |
| 0 | 301 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 302 | | } |
| 2 | 303 | | if (networkWatcherName == null) |
| | 304 | | { |
| 0 | 305 | | throw new ArgumentNullException(nameof(networkWatcherName)); |
| | 306 | | } |
| 2 | 307 | | if (packetCaptureName == null) |
| | 308 | | { |
| 0 | 309 | | throw new ArgumentNullException(nameof(packetCaptureName)); |
| | 310 | | } |
| | 311 | |
|
| 2 | 312 | | using var scope = _clientDiagnostics.CreateScope("PacketCapturesOperations.StartStop"); |
| 2 | 313 | | scope.Start(); |
| | 314 | | try |
| | 315 | | { |
| 2 | 316 | | var originalResponse = await RestClient.StopAsync(resourceGroupName, networkWatcherName, packetCaptureNa |
| 2 | 317 | | return new PacketCapturesStopOperation(_clientDiagnostics, _pipeline, RestClient.CreateStopRequest(resou |
| | 318 | | } |
| 0 | 319 | | catch (Exception e) |
| | 320 | | { |
| 0 | 321 | | scope.Failed(e); |
| 0 | 322 | | throw; |
| | 323 | | } |
| 2 | 324 | | } |
| | 325 | |
|
| | 326 | | /// <summary> Stops a specified packet capture session. </summary> |
| | 327 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 328 | | /// <param name="networkWatcherName"> The name of the network watcher. </param> |
| | 329 | | /// <param name="packetCaptureName"> The name of the packet capture session. </param> |
| | 330 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 331 | | public virtual PacketCapturesStopOperation StartStop(string resourceGroupName, string networkWatcherName, string |
| | 332 | | { |
| 2 | 333 | | if (resourceGroupName == null) |
| | 334 | | { |
| 0 | 335 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 336 | | } |
| 2 | 337 | | if (networkWatcherName == null) |
| | 338 | | { |
| 0 | 339 | | throw new ArgumentNullException(nameof(networkWatcherName)); |
| | 340 | | } |
| 2 | 341 | | if (packetCaptureName == null) |
| | 342 | | { |
| 0 | 343 | | throw new ArgumentNullException(nameof(packetCaptureName)); |
| | 344 | | } |
| | 345 | |
|
| 2 | 346 | | using var scope = _clientDiagnostics.CreateScope("PacketCapturesOperations.StartStop"); |
| 2 | 347 | | scope.Start(); |
| | 348 | | try |
| | 349 | | { |
| 2 | 350 | | var originalResponse = RestClient.Stop(resourceGroupName, networkWatcherName, packetCaptureName, cancell |
| 2 | 351 | | return new PacketCapturesStopOperation(_clientDiagnostics, _pipeline, RestClient.CreateStopRequest(resou |
| | 352 | | } |
| 0 | 353 | | catch (Exception e) |
| | 354 | | { |
| 0 | 355 | | scope.Failed(e); |
| 0 | 356 | | throw; |
| | 357 | | } |
| 2 | 358 | | } |
| | 359 | |
|
| | 360 | | /// <summary> Query the status of a running packet capture session. </summary> |
| | 361 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 362 | | /// <param name="networkWatcherName"> The name of the Network Watcher resource. </param> |
| | 363 | | /// <param name="packetCaptureName"> The name given to the packet capture session. </param> |
| | 364 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 365 | | public virtual async Task<PacketCapturesGetStatusOperation> StartGetStatusAsync(string resourceGroupName, string |
| | 366 | | { |
| 4 | 367 | | if (resourceGroupName == null) |
| | 368 | | { |
| 0 | 369 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 370 | | } |
| 4 | 371 | | if (networkWatcherName == null) |
| | 372 | | { |
| 0 | 373 | | throw new ArgumentNullException(nameof(networkWatcherName)); |
| | 374 | | } |
| 4 | 375 | | if (packetCaptureName == null) |
| | 376 | | { |
| 0 | 377 | | throw new ArgumentNullException(nameof(packetCaptureName)); |
| | 378 | | } |
| | 379 | |
|
| 4 | 380 | | using var scope = _clientDiagnostics.CreateScope("PacketCapturesOperations.StartGetStatus"); |
| 4 | 381 | | scope.Start(); |
| | 382 | | try |
| | 383 | | { |
| 4 | 384 | | var originalResponse = await RestClient.GetStatusAsync(resourceGroupName, networkWatcherName, packetCapt |
| 4 | 385 | | return new PacketCapturesGetStatusOperation(_clientDiagnostics, _pipeline, RestClient.CreateGetStatusReq |
| | 386 | | } |
| 0 | 387 | | catch (Exception e) |
| | 388 | | { |
| 0 | 389 | | scope.Failed(e); |
| 0 | 390 | | throw; |
| | 391 | | } |
| 4 | 392 | | } |
| | 393 | |
|
| | 394 | | /// <summary> Query the status of a running packet capture session. </summary> |
| | 395 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 396 | | /// <param name="networkWatcherName"> The name of the Network Watcher resource. </param> |
| | 397 | | /// <param name="packetCaptureName"> The name given to the packet capture session. </param> |
| | 398 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 399 | | public virtual PacketCapturesGetStatusOperation StartGetStatus(string resourceGroupName, string networkWatcherNa |
| | 400 | | { |
| 4 | 401 | | if (resourceGroupName == null) |
| | 402 | | { |
| 0 | 403 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 404 | | } |
| 4 | 405 | | if (networkWatcherName == null) |
| | 406 | | { |
| 0 | 407 | | throw new ArgumentNullException(nameof(networkWatcherName)); |
| | 408 | | } |
| 4 | 409 | | if (packetCaptureName == null) |
| | 410 | | { |
| 0 | 411 | | throw new ArgumentNullException(nameof(packetCaptureName)); |
| | 412 | | } |
| | 413 | |
|
| 4 | 414 | | using var scope = _clientDiagnostics.CreateScope("PacketCapturesOperations.StartGetStatus"); |
| 4 | 415 | | scope.Start(); |
| | 416 | | try |
| | 417 | | { |
| 4 | 418 | | var originalResponse = RestClient.GetStatus(resourceGroupName, networkWatcherName, packetCaptureName, ca |
| 4 | 419 | | return new PacketCapturesGetStatusOperation(_clientDiagnostics, _pipeline, RestClient.CreateGetStatusReq |
| | 420 | | } |
| 0 | 421 | | catch (Exception e) |
| | 422 | | { |
| 0 | 423 | | scope.Failed(e); |
| 0 | 424 | | throw; |
| | 425 | | } |
| 4 | 426 | | } |
| | 427 | | } |
| | 428 | | } |