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