| | 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 VirtualNetworkTaps service client. </summary> |
| | 19 | | public partial class VirtualNetworkTapsOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 0 | 23 | | internal VirtualNetworkTapsRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of VirtualNetworkTapsOperations for mocking. </summary> |
| 0 | 25 | | protected VirtualNetworkTapsOperations() |
| | 26 | | { |
| 0 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of VirtualNetworkTapsOperations. </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> |
| 0 | 33 | | internal VirtualNetworkTapsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscri |
| | 34 | | { |
| 0 | 35 | | RestClient = new VirtualNetworkTapsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 0 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 37 | | _pipeline = pipeline; |
| 0 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Gets information about the specified virtual network tap. </summary> |
| | 41 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 42 | | /// <param name="tapName"> The name of virtual network tap. </param> |
| | 43 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 44 | | public virtual async Task<Response<VirtualNetworkTap>> GetAsync(string resourceGroupName, string tapName, Cancel |
| | 45 | | { |
| 0 | 46 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworkTapsOperations.Get"); |
| 0 | 47 | | scope.Start(); |
| | 48 | | try |
| | 49 | | { |
| 0 | 50 | | return await RestClient.GetAsync(resourceGroupName, tapName, cancellationToken).ConfigureAwait(false); |
| | 51 | | } |
| 0 | 52 | | catch (Exception e) |
| | 53 | | { |
| 0 | 54 | | scope.Failed(e); |
| 0 | 55 | | throw; |
| | 56 | | } |
| 0 | 57 | | } |
| | 58 | |
|
| | 59 | | /// <summary> Gets information about the specified virtual network tap. </summary> |
| | 60 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 61 | | /// <param name="tapName"> The name of virtual network tap. </param> |
| | 62 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 63 | | public virtual Response<VirtualNetworkTap> Get(string resourceGroupName, string tapName, CancellationToken cance |
| | 64 | | { |
| 0 | 65 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworkTapsOperations.Get"); |
| 0 | 66 | | scope.Start(); |
| | 67 | | try |
| | 68 | | { |
| 0 | 69 | | return RestClient.Get(resourceGroupName, tapName, cancellationToken); |
| | 70 | | } |
| 0 | 71 | | catch (Exception e) |
| | 72 | | { |
| 0 | 73 | | scope.Failed(e); |
| 0 | 74 | | throw; |
| | 75 | | } |
| 0 | 76 | | } |
| | 77 | |
|
| | 78 | | /// <summary> Updates an VirtualNetworkTap tags. </summary> |
| | 79 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 80 | | /// <param name="tapName"> The name of the tap. </param> |
| | 81 | | /// <param name="tapParameters"> Parameters supplied to update VirtualNetworkTap tags. </param> |
| | 82 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 83 | | public virtual async Task<Response<VirtualNetworkTap>> UpdateTagsAsync(string resourceGroupName, string tapName, |
| | 84 | | { |
| 0 | 85 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworkTapsOperations.UpdateTags"); |
| 0 | 86 | | scope.Start(); |
| | 87 | | try |
| | 88 | | { |
| 0 | 89 | | return await RestClient.UpdateTagsAsync(resourceGroupName, tapName, tapParameters, cancellationToken).Co |
| | 90 | | } |
| 0 | 91 | | catch (Exception e) |
| | 92 | | { |
| 0 | 93 | | scope.Failed(e); |
| 0 | 94 | | throw; |
| | 95 | | } |
| 0 | 96 | | } |
| | 97 | |
|
| | 98 | | /// <summary> Updates an VirtualNetworkTap tags. </summary> |
| | 99 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 100 | | /// <param name="tapName"> The name of the tap. </param> |
| | 101 | | /// <param name="tapParameters"> Parameters supplied to update VirtualNetworkTap tags. </param> |
| | 102 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 103 | | public virtual Response<VirtualNetworkTap> UpdateTags(string resourceGroupName, string tapName, TagsObject tapPa |
| | 104 | | { |
| 0 | 105 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworkTapsOperations.UpdateTags"); |
| 0 | 106 | | scope.Start(); |
| | 107 | | try |
| | 108 | | { |
| 0 | 109 | | return RestClient.UpdateTags(resourceGroupName, tapName, tapParameters, cancellationToken); |
| | 110 | | } |
| 0 | 111 | | catch (Exception e) |
| | 112 | | { |
| 0 | 113 | | scope.Failed(e); |
| 0 | 114 | | throw; |
| | 115 | | } |
| 0 | 116 | | } |
| | 117 | |
|
| | 118 | | /// <summary> Gets all the VirtualNetworkTaps in a subscription. </summary> |
| | 119 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 120 | | public virtual AsyncPageable<VirtualNetworkTap> ListAllAsync(CancellationToken cancellationToken = default) |
| | 121 | | { |
| | 122 | | async Task<Page<VirtualNetworkTap>> FirstPageFunc(int? pageSizeHint) |
| | 123 | | { |
| 0 | 124 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworkTapsOperations.ListAll"); |
| 0 | 125 | | scope.Start(); |
| | 126 | | try |
| | 127 | | { |
| 0 | 128 | | var response = await RestClient.ListAllAsync(cancellationToken).ConfigureAwait(false); |
| 0 | 129 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 130 | | } |
| 0 | 131 | | catch (Exception e) |
| | 132 | | { |
| 0 | 133 | | scope.Failed(e); |
| 0 | 134 | | throw; |
| | 135 | | } |
| 0 | 136 | | } |
| | 137 | | async Task<Page<VirtualNetworkTap>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 138 | | { |
| 0 | 139 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworkTapsOperations.ListAll"); |
| 0 | 140 | | scope.Start(); |
| | 141 | | try |
| | 142 | | { |
| 0 | 143 | | var response = await RestClient.ListAllNextPageAsync(nextLink, cancellationToken).ConfigureAwait(fal |
| 0 | 144 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 145 | | } |
| 0 | 146 | | catch (Exception e) |
| | 147 | | { |
| 0 | 148 | | scope.Failed(e); |
| 0 | 149 | | throw; |
| | 150 | | } |
| 0 | 151 | | } |
| 0 | 152 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 153 | | } |
| | 154 | |
|
| | 155 | | /// <summary> Gets all the VirtualNetworkTaps in a subscription. </summary> |
| | 156 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 157 | | public virtual Pageable<VirtualNetworkTap> ListAll(CancellationToken cancellationToken = default) |
| | 158 | | { |
| | 159 | | Page<VirtualNetworkTap> FirstPageFunc(int? pageSizeHint) |
| | 160 | | { |
| 0 | 161 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworkTapsOperations.ListAll"); |
| 0 | 162 | | scope.Start(); |
| | 163 | | try |
| | 164 | | { |
| 0 | 165 | | var response = RestClient.ListAll(cancellationToken); |
| 0 | 166 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 167 | | } |
| 0 | 168 | | catch (Exception e) |
| | 169 | | { |
| 0 | 170 | | scope.Failed(e); |
| 0 | 171 | | throw; |
| | 172 | | } |
| 0 | 173 | | } |
| | 174 | | Page<VirtualNetworkTap> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 175 | | { |
| 0 | 176 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworkTapsOperations.ListAll"); |
| 0 | 177 | | scope.Start(); |
| | 178 | | try |
| | 179 | | { |
| 0 | 180 | | var response = RestClient.ListAllNextPage(nextLink, cancellationToken); |
| 0 | 181 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 182 | | } |
| 0 | 183 | | catch (Exception e) |
| | 184 | | { |
| 0 | 185 | | scope.Failed(e); |
| 0 | 186 | | throw; |
| | 187 | | } |
| 0 | 188 | | } |
| 0 | 189 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 190 | | } |
| | 191 | |
|
| | 192 | | /// <summary> Gets all the VirtualNetworkTaps in a subscription. </summary> |
| | 193 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 194 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 195 | | public virtual AsyncPageable<VirtualNetworkTap> ListByResourceGroupAsync(string resourceGroupName, CancellationT |
| | 196 | | { |
| 0 | 197 | | if (resourceGroupName == null) |
| | 198 | | { |
| 0 | 199 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 200 | | } |
| | 201 | |
|
| | 202 | | async Task<Page<VirtualNetworkTap>> FirstPageFunc(int? pageSizeHint) |
| | 203 | | { |
| 0 | 204 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworkTapsOperations.ListByResourceGroup"); |
| 0 | 205 | | scope.Start(); |
| | 206 | | try |
| | 207 | | { |
| 0 | 208 | | var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).Confi |
| 0 | 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 | | } |
| 0 | 216 | | } |
| | 217 | | async Task<Page<VirtualNetworkTap>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 218 | | { |
| 0 | 219 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworkTapsOperations.ListByResourceGroup"); |
| 0 | 220 | | scope.Start(); |
| | 221 | | try |
| | 222 | | { |
| 0 | 223 | | var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancel |
| 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 | | } |
| 0 | 232 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 233 | | } |
| | 234 | |
|
| | 235 | | /// <summary> Gets all the VirtualNetworkTaps in a subscription. </summary> |
| | 236 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 237 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 238 | | public virtual Pageable<VirtualNetworkTap> ListByResourceGroup(string resourceGroupName, CancellationToken cance |
| | 239 | | { |
| 0 | 240 | | if (resourceGroupName == null) |
| | 241 | | { |
| 0 | 242 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 243 | | } |
| | 244 | |
|
| | 245 | | Page<VirtualNetworkTap> FirstPageFunc(int? pageSizeHint) |
| | 246 | | { |
| 0 | 247 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworkTapsOperations.ListByResourceGroup"); |
| 0 | 248 | | scope.Start(); |
| | 249 | | try |
| | 250 | | { |
| 0 | 251 | | var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken); |
| 0 | 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 | | } |
| 0 | 259 | | } |
| | 260 | | Page<VirtualNetworkTap> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 261 | | { |
| 0 | 262 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworkTapsOperations.ListByResourceGroup"); |
| 0 | 263 | | scope.Start(); |
| | 264 | | try |
| | 265 | | { |
| 0 | 266 | | var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, 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 | | } |
| 0 | 275 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 276 | | } |
| | 277 | |
|
| | 278 | | /// <summary> Deletes the specified virtual network tap. </summary> |
| | 279 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 280 | | /// <param name="tapName"> The name of the virtual network tap. </param> |
| | 281 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 282 | | public virtual async Task<VirtualNetworkTapsDeleteOperation> StartDeleteAsync(string resourceGroupName, string t |
| | 283 | | { |
| 0 | 284 | | if (resourceGroupName == null) |
| | 285 | | { |
| 0 | 286 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 287 | | } |
| 0 | 288 | | if (tapName == null) |
| | 289 | | { |
| 0 | 290 | | throw new ArgumentNullException(nameof(tapName)); |
| | 291 | | } |
| | 292 | |
|
| 0 | 293 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworkTapsOperations.StartDelete"); |
| 0 | 294 | | scope.Start(); |
| | 295 | | try |
| | 296 | | { |
| 0 | 297 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, tapName, cancellationToken).Confi |
| 0 | 298 | | return new VirtualNetworkTapsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteReque |
| | 299 | | } |
| 0 | 300 | | catch (Exception e) |
| | 301 | | { |
| 0 | 302 | | scope.Failed(e); |
| 0 | 303 | | throw; |
| | 304 | | } |
| 0 | 305 | | } |
| | 306 | |
|
| | 307 | | /// <summary> Deletes the specified virtual network tap. </summary> |
| | 308 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 309 | | /// <param name="tapName"> The name of the virtual network tap. </param> |
| | 310 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 311 | | public virtual VirtualNetworkTapsDeleteOperation StartDelete(string resourceGroupName, string tapName, Cancellat |
| | 312 | | { |
| 0 | 313 | | if (resourceGroupName == null) |
| | 314 | | { |
| 0 | 315 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 316 | | } |
| 0 | 317 | | if (tapName == null) |
| | 318 | | { |
| 0 | 319 | | throw new ArgumentNullException(nameof(tapName)); |
| | 320 | | } |
| | 321 | |
|
| 0 | 322 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworkTapsOperations.StartDelete"); |
| 0 | 323 | | scope.Start(); |
| | 324 | | try |
| | 325 | | { |
| 0 | 326 | | var originalResponse = RestClient.Delete(resourceGroupName, tapName, cancellationToken); |
| 0 | 327 | | return new VirtualNetworkTapsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteReque |
| | 328 | | } |
| 0 | 329 | | catch (Exception e) |
| | 330 | | { |
| 0 | 331 | | scope.Failed(e); |
| 0 | 332 | | throw; |
| | 333 | | } |
| 0 | 334 | | } |
| | 335 | |
|
| | 336 | | /// <summary> Creates or updates a Virtual Network Tap. </summary> |
| | 337 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 338 | | /// <param name="tapName"> The name of the virtual network tap. </param> |
| | 339 | | /// <param name="parameters"> Parameters supplied to the create or update virtual network tap operation. </param |
| | 340 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 341 | | public virtual async Task<VirtualNetworkTapsCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGro |
| | 342 | | { |
| 0 | 343 | | if (resourceGroupName == null) |
| | 344 | | { |
| 0 | 345 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 346 | | } |
| 0 | 347 | | if (tapName == null) |
| | 348 | | { |
| 0 | 349 | | throw new ArgumentNullException(nameof(tapName)); |
| | 350 | | } |
| 0 | 351 | | if (parameters == null) |
| | 352 | | { |
| 0 | 353 | | throw new ArgumentNullException(nameof(parameters)); |
| | 354 | | } |
| | 355 | |
|
| 0 | 356 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworkTapsOperations.StartCreateOrUpdate"); |
| 0 | 357 | | scope.Start(); |
| | 358 | | try |
| | 359 | | { |
| 0 | 360 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, tapName, parameters, canc |
| 0 | 361 | | return new VirtualNetworkTapsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCre |
| | 362 | | } |
| 0 | 363 | | catch (Exception e) |
| | 364 | | { |
| 0 | 365 | | scope.Failed(e); |
| 0 | 366 | | throw; |
| | 367 | | } |
| 0 | 368 | | } |
| | 369 | |
|
| | 370 | | /// <summary> Creates or updates a Virtual Network Tap. </summary> |
| | 371 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 372 | | /// <param name="tapName"> The name of the virtual network tap. </param> |
| | 373 | | /// <param name="parameters"> Parameters supplied to the create or update virtual network tap operation. </param |
| | 374 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 375 | | public virtual VirtualNetworkTapsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string ta |
| | 376 | | { |
| 0 | 377 | | if (resourceGroupName == null) |
| | 378 | | { |
| 0 | 379 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 380 | | } |
| 0 | 381 | | if (tapName == null) |
| | 382 | | { |
| 0 | 383 | | throw new ArgumentNullException(nameof(tapName)); |
| | 384 | | } |
| 0 | 385 | | if (parameters == null) |
| | 386 | | { |
| 0 | 387 | | throw new ArgumentNullException(nameof(parameters)); |
| | 388 | | } |
| | 389 | |
|
| 0 | 390 | | using var scope = _clientDiagnostics.CreateScope("VirtualNetworkTapsOperations.StartCreateOrUpdate"); |
| 0 | 391 | | scope.Start(); |
| | 392 | | try |
| | 393 | | { |
| 0 | 394 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, tapName, parameters, cancellationTok |
| 0 | 395 | | return new VirtualNetworkTapsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCre |
| | 396 | | } |
| 0 | 397 | | catch (Exception e) |
| | 398 | | { |
| 0 | 399 | | scope.Failed(e); |
| 0 | 400 | | throw; |
| | 401 | | } |
| 0 | 402 | | } |
| | 403 | | } |
| | 404 | | } |