| | 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 VpnSiteLinks service client. </summary> |
| | 19 | | public partial class VpnSiteLinksOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 0 | 23 | | internal VpnSiteLinksRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of VpnSiteLinksOperations for mocking. </summary> |
| 0 | 25 | | protected VpnSiteLinksOperations() |
| | 26 | | { |
| 0 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of VpnSiteLinksOperations. </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 VpnSiteLinksOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionI |
| | 34 | | { |
| 0 | 35 | | RestClient = new VpnSiteLinksRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 0 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 37 | | _pipeline = pipeline; |
| 0 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Retrieves the details of a VPN site link. </summary> |
| | 41 | | /// <param name="resourceGroupName"> The resource group name of the VpnSite. </param> |
| | 42 | | /// <param name="vpnSiteName"> The name of the VpnSite. </param> |
| | 43 | | /// <param name="vpnSiteLinkName"> The name of the VpnSiteLink being retrieved. </param> |
| | 44 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 45 | | public virtual async Task<Response<VpnSiteLink>> GetAsync(string resourceGroupName, string vpnSiteName, string v |
| | 46 | | { |
| 0 | 47 | | using var scope = _clientDiagnostics.CreateScope("VpnSiteLinksOperations.Get"); |
| 0 | 48 | | scope.Start(); |
| | 49 | | try |
| | 50 | | { |
| 0 | 51 | | return await RestClient.GetAsync(resourceGroupName, vpnSiteName, vpnSiteLinkName, cancellationToken).Con |
| | 52 | | } |
| 0 | 53 | | catch (Exception e) |
| | 54 | | { |
| 0 | 55 | | scope.Failed(e); |
| 0 | 56 | | throw; |
| | 57 | | } |
| 0 | 58 | | } |
| | 59 | |
|
| | 60 | | /// <summary> Retrieves the details of a VPN site link. </summary> |
| | 61 | | /// <param name="resourceGroupName"> The resource group name of the VpnSite. </param> |
| | 62 | | /// <param name="vpnSiteName"> The name of the VpnSite. </param> |
| | 63 | | /// <param name="vpnSiteLinkName"> The name of the VpnSiteLink being retrieved. </param> |
| | 64 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 65 | | public virtual Response<VpnSiteLink> Get(string resourceGroupName, string vpnSiteName, string vpnSiteLinkName, C |
| | 66 | | { |
| 0 | 67 | | using var scope = _clientDiagnostics.CreateScope("VpnSiteLinksOperations.Get"); |
| 0 | 68 | | scope.Start(); |
| | 69 | | try |
| | 70 | | { |
| 0 | 71 | | return RestClient.Get(resourceGroupName, vpnSiteName, vpnSiteLinkName, cancellationToken); |
| | 72 | | } |
| 0 | 73 | | catch (Exception e) |
| | 74 | | { |
| 0 | 75 | | scope.Failed(e); |
| 0 | 76 | | throw; |
| | 77 | | } |
| 0 | 78 | | } |
| | 79 | |
|
| | 80 | | /// <summary> Lists all the vpnSiteLinks in a resource group for a vpn site. </summary> |
| | 81 | | /// <param name="resourceGroupName"> The resource group name of the VpnSite. </param> |
| | 82 | | /// <param name="vpnSiteName"> The name of the VpnSite. </param> |
| | 83 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 84 | | public virtual AsyncPageable<VpnSiteLink> ListByVpnSiteAsync(string resourceGroupName, string vpnSiteName, Cance |
| | 85 | | { |
| 0 | 86 | | if (resourceGroupName == null) |
| | 87 | | { |
| 0 | 88 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 89 | | } |
| 0 | 90 | | if (vpnSiteName == null) |
| | 91 | | { |
| 0 | 92 | | throw new ArgumentNullException(nameof(vpnSiteName)); |
| | 93 | | } |
| | 94 | |
|
| | 95 | | async Task<Page<VpnSiteLink>> FirstPageFunc(int? pageSizeHint) |
| | 96 | | { |
| 0 | 97 | | using var scope = _clientDiagnostics.CreateScope("VpnSiteLinksOperations.ListByVpnSite"); |
| 0 | 98 | | scope.Start(); |
| | 99 | | try |
| | 100 | | { |
| 0 | 101 | | var response = await RestClient.ListByVpnSiteAsync(resourceGroupName, vpnSiteName, cancellationToken |
| 0 | 102 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 103 | | } |
| 0 | 104 | | catch (Exception e) |
| | 105 | | { |
| 0 | 106 | | scope.Failed(e); |
| 0 | 107 | | throw; |
| | 108 | | } |
| 0 | 109 | | } |
| | 110 | | async Task<Page<VpnSiteLink>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 111 | | { |
| 0 | 112 | | using var scope = _clientDiagnostics.CreateScope("VpnSiteLinksOperations.ListByVpnSite"); |
| 0 | 113 | | scope.Start(); |
| | 114 | | try |
| | 115 | | { |
| 0 | 116 | | var response = await RestClient.ListByVpnSiteNextPageAsync(nextLink, resourceGroupName, vpnSiteName, |
| 0 | 117 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 118 | | } |
| 0 | 119 | | catch (Exception e) |
| | 120 | | { |
| 0 | 121 | | scope.Failed(e); |
| 0 | 122 | | throw; |
| | 123 | | } |
| 0 | 124 | | } |
| 0 | 125 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 126 | | } |
| | 127 | |
|
| | 128 | | /// <summary> Lists all the vpnSiteLinks in a resource group for a vpn site. </summary> |
| | 129 | | /// <param name="resourceGroupName"> The resource group name of the VpnSite. </param> |
| | 130 | | /// <param name="vpnSiteName"> The name of the VpnSite. </param> |
| | 131 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 132 | | public virtual Pageable<VpnSiteLink> ListByVpnSite(string resourceGroupName, string vpnSiteName, CancellationTok |
| | 133 | | { |
| 0 | 134 | | if (resourceGroupName == null) |
| | 135 | | { |
| 0 | 136 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 137 | | } |
| 0 | 138 | | if (vpnSiteName == null) |
| | 139 | | { |
| 0 | 140 | | throw new ArgumentNullException(nameof(vpnSiteName)); |
| | 141 | | } |
| | 142 | |
|
| | 143 | | Page<VpnSiteLink> FirstPageFunc(int? pageSizeHint) |
| | 144 | | { |
| 0 | 145 | | using var scope = _clientDiagnostics.CreateScope("VpnSiteLinksOperations.ListByVpnSite"); |
| 0 | 146 | | scope.Start(); |
| | 147 | | try |
| | 148 | | { |
| 0 | 149 | | var response = RestClient.ListByVpnSite(resourceGroupName, vpnSiteName, cancellationToken); |
| 0 | 150 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 151 | | } |
| 0 | 152 | | catch (Exception e) |
| | 153 | | { |
| 0 | 154 | | scope.Failed(e); |
| 0 | 155 | | throw; |
| | 156 | | } |
| 0 | 157 | | } |
| | 158 | | Page<VpnSiteLink> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 159 | | { |
| 0 | 160 | | using var scope = _clientDiagnostics.CreateScope("VpnSiteLinksOperations.ListByVpnSite"); |
| 0 | 161 | | scope.Start(); |
| | 162 | | try |
| | 163 | | { |
| 0 | 164 | | var response = RestClient.ListByVpnSiteNextPage(nextLink, resourceGroupName, vpnSiteName, cancellati |
| 0 | 165 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 166 | | } |
| 0 | 167 | | catch (Exception e) |
| | 168 | | { |
| 0 | 169 | | scope.Failed(e); |
| 0 | 170 | | throw; |
| | 171 | | } |
| 0 | 172 | | } |
| 0 | 173 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 174 | | } |
| | 175 | | } |
| | 176 | | } |