| | | 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 VpnConnections service client. </summary> |
| | | 19 | | public partial class VpnConnectionsOperations |
| | | 20 | | { |
| | | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | | 22 | | private readonly HttpPipeline _pipeline; |
| | 0 | 23 | | internal VpnConnectionsRestOperations RestClient { get; } |
| | | 24 | | /// <summary> Initializes a new instance of VpnConnectionsOperations for mocking. </summary> |
| | 0 | 25 | | protected VpnConnectionsOperations() |
| | | 26 | | { |
| | 0 | 27 | | } |
| | | 28 | | /// <summary> Initializes a new instance of VpnConnectionsOperations. </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 VpnConnectionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptio |
| | | 34 | | { |
| | 0 | 35 | | RestClient = new VpnConnectionsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| | 0 | 36 | | _clientDiagnostics = clientDiagnostics; |
| | 0 | 37 | | _pipeline = pipeline; |
| | 0 | 38 | | } |
| | | 39 | | |
| | | 40 | | /// <summary> Retrieves the details of a vpn connection. </summary> |
| | | 41 | | /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param> |
| | | 42 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | | 43 | | /// <param name="connectionName"> The name of the vpn connection. </param> |
| | | 44 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 45 | | public virtual async Task<Response<VpnConnection>> GetAsync(string resourceGroupName, string gatewayName, string |
| | | 46 | | { |
| | 0 | 47 | | using var scope = _clientDiagnostics.CreateScope("VpnConnectionsOperations.Get"); |
| | 0 | 48 | | scope.Start(); |
| | | 49 | | try |
| | | 50 | | { |
| | 0 | 51 | | return await RestClient.GetAsync(resourceGroupName, gatewayName, connectionName, cancellationToken).Conf |
| | | 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 connection. </summary> |
| | | 61 | | /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param> |
| | | 62 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | | 63 | | /// <param name="connectionName"> The name of the vpn connection. </param> |
| | | 64 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 65 | | public virtual Response<VpnConnection> Get(string resourceGroupName, string gatewayName, string connectionName, |
| | | 66 | | { |
| | 0 | 67 | | using var scope = _clientDiagnostics.CreateScope("VpnConnectionsOperations.Get"); |
| | 0 | 68 | | scope.Start(); |
| | | 69 | | try |
| | | 70 | | { |
| | 0 | 71 | | return RestClient.Get(resourceGroupName, gatewayName, connectionName, cancellationToken); |
| | | 72 | | } |
| | 0 | 73 | | catch (Exception e) |
| | | 74 | | { |
| | 0 | 75 | | scope.Failed(e); |
| | 0 | 76 | | throw; |
| | | 77 | | } |
| | 0 | 78 | | } |
| | | 79 | | |
| | | 80 | | /// <summary> Retrieves all vpn connections for a particular virtual wan vpn gateway. </summary> |
| | | 81 | | /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param> |
| | | 82 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | | 83 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 84 | | public virtual AsyncPageable<VpnConnection> ListByVpnGatewayAsync(string resourceGroupName, string gatewayName, |
| | | 85 | | { |
| | 0 | 86 | | if (resourceGroupName == null) |
| | | 87 | | { |
| | 0 | 88 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 89 | | } |
| | 0 | 90 | | if (gatewayName == null) |
| | | 91 | | { |
| | 0 | 92 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | | 93 | | } |
| | | 94 | | |
| | | 95 | | async Task<Page<VpnConnection>> FirstPageFunc(int? pageSizeHint) |
| | | 96 | | { |
| | 0 | 97 | | using var scope = _clientDiagnostics.CreateScope("VpnConnectionsOperations.ListByVpnGateway"); |
| | 0 | 98 | | scope.Start(); |
| | | 99 | | try |
| | | 100 | | { |
| | 0 | 101 | | var response = await RestClient.ListByVpnGatewayAsync(resourceGroupName, gatewayName, cancellationTo |
| | 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<VpnConnection>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | | 111 | | { |
| | 0 | 112 | | using var scope = _clientDiagnostics.CreateScope("VpnConnectionsOperations.ListByVpnGateway"); |
| | 0 | 113 | | scope.Start(); |
| | | 114 | | try |
| | | 115 | | { |
| | 0 | 116 | | var response = await RestClient.ListByVpnGatewayNextPageAsync(nextLink, resourceGroupName, gatewayNa |
| | 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> Retrieves all vpn connections for a particular virtual wan vpn gateway. </summary> |
| | | 129 | | /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param> |
| | | 130 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | | 131 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 132 | | public virtual Pageable<VpnConnection> ListByVpnGateway(string resourceGroupName, string gatewayName, Cancellati |
| | | 133 | | { |
| | 0 | 134 | | if (resourceGroupName == null) |
| | | 135 | | { |
| | 0 | 136 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 137 | | } |
| | 0 | 138 | | if (gatewayName == null) |
| | | 139 | | { |
| | 0 | 140 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | | 141 | | } |
| | | 142 | | |
| | | 143 | | Page<VpnConnection> FirstPageFunc(int? pageSizeHint) |
| | | 144 | | { |
| | 0 | 145 | | using var scope = _clientDiagnostics.CreateScope("VpnConnectionsOperations.ListByVpnGateway"); |
| | 0 | 146 | | scope.Start(); |
| | | 147 | | try |
| | | 148 | | { |
| | 0 | 149 | | var response = RestClient.ListByVpnGateway(resourceGroupName, gatewayName, 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<VpnConnection> NextPageFunc(string nextLink, int? pageSizeHint) |
| | | 159 | | { |
| | 0 | 160 | | using var scope = _clientDiagnostics.CreateScope("VpnConnectionsOperations.ListByVpnGateway"); |
| | 0 | 161 | | scope.Start(); |
| | | 162 | | try |
| | | 163 | | { |
| | 0 | 164 | | var response = RestClient.ListByVpnGatewayNextPage(nextLink, resourceGroupName, gatewayName, cancell |
| | 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 | | /// <summary> Creates a vpn connection to a scalable vpn gateway if it doesn't exist else updates the exist |
| | | 177 | | /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param> |
| | | 178 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | | 179 | | /// <param name="connectionName"> The name of the connection. </param> |
| | | 180 | | /// <param name="vpnConnectionParameters"> Parameters supplied to create or Update a VPN Connection. </param> |
| | | 181 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 182 | | public virtual async Task<VpnConnectionsCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroupNa |
| | | 183 | | { |
| | 0 | 184 | | if (resourceGroupName == null) |
| | | 185 | | { |
| | 0 | 186 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 187 | | } |
| | 0 | 188 | | if (gatewayName == null) |
| | | 189 | | { |
| | 0 | 190 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | | 191 | | } |
| | 0 | 192 | | if (connectionName == null) |
| | | 193 | | { |
| | 0 | 194 | | throw new ArgumentNullException(nameof(connectionName)); |
| | | 195 | | } |
| | 0 | 196 | | if (vpnConnectionParameters == null) |
| | | 197 | | { |
| | 0 | 198 | | throw new ArgumentNullException(nameof(vpnConnectionParameters)); |
| | | 199 | | } |
| | | 200 | | |
| | 0 | 201 | | using var scope = _clientDiagnostics.CreateScope("VpnConnectionsOperations.StartCreateOrUpdate"); |
| | 0 | 202 | | scope.Start(); |
| | | 203 | | try |
| | | 204 | | { |
| | 0 | 205 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, gatewayName, connectionNa |
| | 0 | 206 | | return new VpnConnectionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateO |
| | | 207 | | } |
| | 0 | 208 | | catch (Exception e) |
| | | 209 | | { |
| | 0 | 210 | | scope.Failed(e); |
| | 0 | 211 | | throw; |
| | | 212 | | } |
| | 0 | 213 | | } |
| | | 214 | | |
| | | 215 | | /// <summary> Creates a vpn connection to a scalable vpn gateway if it doesn't exist else updates the exist |
| | | 216 | | /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param> |
| | | 217 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | | 218 | | /// <param name="connectionName"> The name of the connection. </param> |
| | | 219 | | /// <param name="vpnConnectionParameters"> Parameters supplied to create or Update a VPN Connection. </param> |
| | | 220 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 221 | | public virtual VpnConnectionsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string gatewa |
| | | 222 | | { |
| | 0 | 223 | | if (resourceGroupName == null) |
| | | 224 | | { |
| | 0 | 225 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 226 | | } |
| | 0 | 227 | | if (gatewayName == null) |
| | | 228 | | { |
| | 0 | 229 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | | 230 | | } |
| | 0 | 231 | | if (connectionName == null) |
| | | 232 | | { |
| | 0 | 233 | | throw new ArgumentNullException(nameof(connectionName)); |
| | | 234 | | } |
| | 0 | 235 | | if (vpnConnectionParameters == null) |
| | | 236 | | { |
| | 0 | 237 | | throw new ArgumentNullException(nameof(vpnConnectionParameters)); |
| | | 238 | | } |
| | | 239 | | |
| | 0 | 240 | | using var scope = _clientDiagnostics.CreateScope("VpnConnectionsOperations.StartCreateOrUpdate"); |
| | 0 | 241 | | scope.Start(); |
| | | 242 | | try |
| | | 243 | | { |
| | 0 | 244 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, gatewayName, connectionName, vpnConn |
| | 0 | 245 | | return new VpnConnectionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateO |
| | | 246 | | } |
| | 0 | 247 | | catch (Exception e) |
| | | 248 | | { |
| | 0 | 249 | | scope.Failed(e); |
| | 0 | 250 | | throw; |
| | | 251 | | } |
| | 0 | 252 | | } |
| | | 253 | | |
| | | 254 | | /// <summary> Deletes a vpn connection. </summary> |
| | | 255 | | /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param> |
| | | 256 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | | 257 | | /// <param name="connectionName"> The name of the connection. </param> |
| | | 258 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 259 | | public virtual async Task<VpnConnectionsDeleteOperation> StartDeleteAsync(string resourceGroupName, string gatew |
| | | 260 | | { |
| | 0 | 261 | | if (resourceGroupName == null) |
| | | 262 | | { |
| | 0 | 263 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 264 | | } |
| | 0 | 265 | | if (gatewayName == null) |
| | | 266 | | { |
| | 0 | 267 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | | 268 | | } |
| | 0 | 269 | | if (connectionName == null) |
| | | 270 | | { |
| | 0 | 271 | | throw new ArgumentNullException(nameof(connectionName)); |
| | | 272 | | } |
| | | 273 | | |
| | 0 | 274 | | using var scope = _clientDiagnostics.CreateScope("VpnConnectionsOperations.StartDelete"); |
| | 0 | 275 | | scope.Start(); |
| | | 276 | | try |
| | | 277 | | { |
| | 0 | 278 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, gatewayName, connectionName, canc |
| | 0 | 279 | | return new VpnConnectionsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(r |
| | | 280 | | } |
| | 0 | 281 | | catch (Exception e) |
| | | 282 | | { |
| | 0 | 283 | | scope.Failed(e); |
| | 0 | 284 | | throw; |
| | | 285 | | } |
| | 0 | 286 | | } |
| | | 287 | | |
| | | 288 | | /// <summary> Deletes a vpn connection. </summary> |
| | | 289 | | /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param> |
| | | 290 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | | 291 | | /// <param name="connectionName"> The name of the connection. </param> |
| | | 292 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 293 | | public virtual VpnConnectionsDeleteOperation StartDelete(string resourceGroupName, string gatewayName, string co |
| | | 294 | | { |
| | 0 | 295 | | if (resourceGroupName == null) |
| | | 296 | | { |
| | 0 | 297 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 298 | | } |
| | 0 | 299 | | if (gatewayName == null) |
| | | 300 | | { |
| | 0 | 301 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | | 302 | | } |
| | 0 | 303 | | if (connectionName == null) |
| | | 304 | | { |
| | 0 | 305 | | throw new ArgumentNullException(nameof(connectionName)); |
| | | 306 | | } |
| | | 307 | | |
| | 0 | 308 | | using var scope = _clientDiagnostics.CreateScope("VpnConnectionsOperations.StartDelete"); |
| | 0 | 309 | | scope.Start(); |
| | | 310 | | try |
| | | 311 | | { |
| | 0 | 312 | | var originalResponse = RestClient.Delete(resourceGroupName, gatewayName, connectionName, cancellationTok |
| | 0 | 313 | | return new VpnConnectionsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(r |
| | | 314 | | } |
| | 0 | 315 | | catch (Exception e) |
| | | 316 | | { |
| | 0 | 317 | | scope.Failed(e); |
| | 0 | 318 | | throw; |
| | | 319 | | } |
| | 0 | 320 | | } |
| | | 321 | | } |
| | | 322 | | } |