| | 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.Text.Json; |
| | 10 | | using System.Threading; |
| | 11 | | using System.Threading.Tasks; |
| | 12 | | using Azure; |
| | 13 | | using Azure.Core; |
| | 14 | | using Azure.Core.Pipeline; |
| | 15 | | using Azure.ResourceManager.Network.Models; |
| | 16 | |
|
| | 17 | | namespace Azure.ResourceManager.Network |
| | 18 | | { |
| | 19 | | internal partial class VpnServerConfigurationsRestOperations |
| | 20 | | { |
| | 21 | | private string subscriptionId; |
| | 22 | | private Uri endpoint; |
| | 23 | | private ClientDiagnostics _clientDiagnostics; |
| | 24 | | private HttpPipeline _pipeline; |
| | 25 | |
|
| | 26 | | /// <summary> Initializes a new instance of VpnServerConfigurationsRestOperations. </summary> |
| | 27 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 28 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 29 | | /// <param name="subscriptionId"> The subscription credentials which uniquely identify the Microsoft Azure subsc |
| | 30 | | /// <param name="endpoint"> server parameter. </param> |
| | 31 | | /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception |
| 0 | 32 | | public VpnServerConfigurationsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string |
| | 33 | | { |
| 0 | 34 | | if (subscriptionId == null) |
| | 35 | | { |
| 0 | 36 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 37 | | } |
| 0 | 38 | | endpoint ??= new Uri("https://management.azure.com"); |
| | 39 | |
|
| 0 | 40 | | this.subscriptionId = subscriptionId; |
| 0 | 41 | | this.endpoint = endpoint; |
| 0 | 42 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 43 | | _pipeline = pipeline; |
| 0 | 44 | | } |
| | 45 | |
|
| | 46 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string vpnServerConfigurationName) |
| | 47 | | { |
| 0 | 48 | | var message = _pipeline.CreateMessage(); |
| 0 | 49 | | var request = message.Request; |
| 0 | 50 | | request.Method = RequestMethod.Get; |
| 0 | 51 | | var uri = new RawRequestUriBuilder(); |
| 0 | 52 | | uri.Reset(endpoint); |
| 0 | 53 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 54 | | uri.AppendPath(subscriptionId, true); |
| 0 | 55 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 56 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 57 | | uri.AppendPath("/providers/Microsoft.Network/vpnServerConfigurations/", false); |
| 0 | 58 | | uri.AppendPath(vpnServerConfigurationName, true); |
| 0 | 59 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 60 | | request.Uri = uri; |
| 0 | 61 | | return message; |
| | 62 | | } |
| | 63 | |
|
| | 64 | | /// <summary> Retrieves the details of a VpnServerConfiguration. </summary> |
| | 65 | | /// <param name="resourceGroupName"> The resource group name of the VpnServerConfiguration. </param> |
| | 66 | | /// <param name="vpnServerConfigurationName"> The name of the VpnServerConfiguration being retrieved. </param> |
| | 67 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 68 | | public async Task<Response<VpnServerConfiguration>> GetAsync(string resourceGroupName, string vpnServerConfigura |
| | 69 | | { |
| 0 | 70 | | if (resourceGroupName == null) |
| | 71 | | { |
| 0 | 72 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 73 | | } |
| 0 | 74 | | if (vpnServerConfigurationName == null) |
| | 75 | | { |
| 0 | 76 | | throw new ArgumentNullException(nameof(vpnServerConfigurationName)); |
| | 77 | | } |
| | 78 | |
|
| 0 | 79 | | using var message = CreateGetRequest(resourceGroupName, vpnServerConfigurationName); |
| 0 | 80 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 81 | | switch (message.Response.Status) |
| | 82 | | { |
| | 83 | | case 200: |
| | 84 | | { |
| 0 | 85 | | VpnServerConfiguration value = default; |
| 0 | 86 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 87 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 88 | | { |
| 0 | 89 | | value = null; |
| | 90 | | } |
| | 91 | | else |
| | 92 | | { |
| 0 | 93 | | value = VpnServerConfiguration.DeserializeVpnServerConfiguration(document.RootElement); |
| | 94 | | } |
| 0 | 95 | | return Response.FromValue(value, message.Response); |
| | 96 | | } |
| | 97 | | default: |
| 0 | 98 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 99 | | } |
| 0 | 100 | | } |
| | 101 | |
|
| | 102 | | /// <summary> Retrieves the details of a VpnServerConfiguration. </summary> |
| | 103 | | /// <param name="resourceGroupName"> The resource group name of the VpnServerConfiguration. </param> |
| | 104 | | /// <param name="vpnServerConfigurationName"> The name of the VpnServerConfiguration being retrieved. </param> |
| | 105 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 106 | | public Response<VpnServerConfiguration> Get(string resourceGroupName, string vpnServerConfigurationName, Cancell |
| | 107 | | { |
| 0 | 108 | | if (resourceGroupName == null) |
| | 109 | | { |
| 0 | 110 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 111 | | } |
| 0 | 112 | | if (vpnServerConfigurationName == null) |
| | 113 | | { |
| 0 | 114 | | throw new ArgumentNullException(nameof(vpnServerConfigurationName)); |
| | 115 | | } |
| | 116 | |
|
| 0 | 117 | | using var message = CreateGetRequest(resourceGroupName, vpnServerConfigurationName); |
| 0 | 118 | | _pipeline.Send(message, cancellationToken); |
| 0 | 119 | | switch (message.Response.Status) |
| | 120 | | { |
| | 121 | | case 200: |
| | 122 | | { |
| 0 | 123 | | VpnServerConfiguration value = default; |
| 0 | 124 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 125 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 126 | | { |
| 0 | 127 | | value = null; |
| | 128 | | } |
| | 129 | | else |
| | 130 | | { |
| 0 | 131 | | value = VpnServerConfiguration.DeserializeVpnServerConfiguration(document.RootElement); |
| | 132 | | } |
| 0 | 133 | | return Response.FromValue(value, message.Response); |
| | 134 | | } |
| | 135 | | default: |
| 0 | 136 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 137 | | } |
| 0 | 138 | | } |
| | 139 | |
|
| | 140 | | internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string vpnServerConfigurationName, Vp |
| | 141 | | { |
| 0 | 142 | | var message = _pipeline.CreateMessage(); |
| 0 | 143 | | var request = message.Request; |
| 0 | 144 | | request.Method = RequestMethod.Put; |
| 0 | 145 | | var uri = new RawRequestUriBuilder(); |
| 0 | 146 | | uri.Reset(endpoint); |
| 0 | 147 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 148 | | uri.AppendPath(subscriptionId, true); |
| 0 | 149 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 150 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 151 | | uri.AppendPath("/providers/Microsoft.Network/vpnServerConfigurations/", false); |
| 0 | 152 | | uri.AppendPath(vpnServerConfigurationName, true); |
| 0 | 153 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 154 | | request.Uri = uri; |
| 0 | 155 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 156 | | var content = new Utf8JsonRequestContent(); |
| 0 | 157 | | content.JsonWriter.WriteObjectValue(vpnServerConfigurationParameters); |
| 0 | 158 | | request.Content = content; |
| 0 | 159 | | return message; |
| | 160 | | } |
| | 161 | |
|
| | 162 | | /// <summary> Creates a VpnServerConfiguration resource if it doesn't exist else updates the existing VpnSe |
| | 163 | | /// <param name="resourceGroupName"> The resource group name of the VpnServerConfiguration. </param> |
| | 164 | | /// <param name="vpnServerConfigurationName"> The name of the VpnServerConfiguration being created or updated. < |
| | 165 | | /// <param name="vpnServerConfigurationParameters"> Parameters supplied to create or update VpnServerConfigurati |
| | 166 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 167 | | public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string vpnServerConfigurationName, Vpn |
| | 168 | | { |
| 0 | 169 | | if (resourceGroupName == null) |
| | 170 | | { |
| 0 | 171 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 172 | | } |
| 0 | 173 | | if (vpnServerConfigurationName == null) |
| | 174 | | { |
| 0 | 175 | | throw new ArgumentNullException(nameof(vpnServerConfigurationName)); |
| | 176 | | } |
| 0 | 177 | | if (vpnServerConfigurationParameters == null) |
| | 178 | | { |
| 0 | 179 | | throw new ArgumentNullException(nameof(vpnServerConfigurationParameters)); |
| | 180 | | } |
| | 181 | |
|
| 0 | 182 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, vpnServerConfigurationName, vpnServerConf |
| 0 | 183 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 184 | | switch (message.Response.Status) |
| | 185 | | { |
| | 186 | | case 200: |
| | 187 | | case 201: |
| 0 | 188 | | return message.Response; |
| | 189 | | default: |
| 0 | 190 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 191 | | } |
| 0 | 192 | | } |
| | 193 | |
|
| | 194 | | /// <summary> Creates a VpnServerConfiguration resource if it doesn't exist else updates the existing VpnSe |
| | 195 | | /// <param name="resourceGroupName"> The resource group name of the VpnServerConfiguration. </param> |
| | 196 | | /// <param name="vpnServerConfigurationName"> The name of the VpnServerConfiguration being created or updated. < |
| | 197 | | /// <param name="vpnServerConfigurationParameters"> Parameters supplied to create or update VpnServerConfigurati |
| | 198 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 199 | | public Response CreateOrUpdate(string resourceGroupName, string vpnServerConfigurationName, VpnServerConfigurati |
| | 200 | | { |
| 0 | 201 | | if (resourceGroupName == null) |
| | 202 | | { |
| 0 | 203 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 204 | | } |
| 0 | 205 | | if (vpnServerConfigurationName == null) |
| | 206 | | { |
| 0 | 207 | | throw new ArgumentNullException(nameof(vpnServerConfigurationName)); |
| | 208 | | } |
| 0 | 209 | | if (vpnServerConfigurationParameters == null) |
| | 210 | | { |
| 0 | 211 | | throw new ArgumentNullException(nameof(vpnServerConfigurationParameters)); |
| | 212 | | } |
| | 213 | |
|
| 0 | 214 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, vpnServerConfigurationName, vpnServerConf |
| 0 | 215 | | _pipeline.Send(message, cancellationToken); |
| 0 | 216 | | switch (message.Response.Status) |
| | 217 | | { |
| | 218 | | case 200: |
| | 219 | | case 201: |
| 0 | 220 | | return message.Response; |
| | 221 | | default: |
| 0 | 222 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 223 | | } |
| 0 | 224 | | } |
| | 225 | |
|
| | 226 | | internal HttpMessage CreateUpdateTagsRequest(string resourceGroupName, string vpnServerConfigurationName, TagsOb |
| | 227 | | { |
| 0 | 228 | | var message = _pipeline.CreateMessage(); |
| 0 | 229 | | var request = message.Request; |
| 0 | 230 | | request.Method = RequestMethod.Patch; |
| 0 | 231 | | var uri = new RawRequestUriBuilder(); |
| 0 | 232 | | uri.Reset(endpoint); |
| 0 | 233 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 234 | | uri.AppendPath(subscriptionId, true); |
| 0 | 235 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 236 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 237 | | uri.AppendPath("/providers/Microsoft.Network/vpnServerConfigurations/", false); |
| 0 | 238 | | uri.AppendPath(vpnServerConfigurationName, true); |
| 0 | 239 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 240 | | request.Uri = uri; |
| 0 | 241 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 242 | | var content = new Utf8JsonRequestContent(); |
| 0 | 243 | | content.JsonWriter.WriteObjectValue(vpnServerConfigurationParameters); |
| 0 | 244 | | request.Content = content; |
| 0 | 245 | | return message; |
| | 246 | | } |
| | 247 | |
|
| | 248 | | /// <summary> Updates VpnServerConfiguration tags. </summary> |
| | 249 | | /// <param name="resourceGroupName"> The resource group name of the VpnServerConfiguration. </param> |
| | 250 | | /// <param name="vpnServerConfigurationName"> The name of the VpnServerConfiguration being updated. </param> |
| | 251 | | /// <param name="vpnServerConfigurationParameters"> Parameters supplied to update VpnServerConfiguration tags. < |
| | 252 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 253 | | public async Task<Response<VpnServerConfiguration>> UpdateTagsAsync(string resourceGroupName, string vpnServerCo |
| | 254 | | { |
| 0 | 255 | | if (resourceGroupName == null) |
| | 256 | | { |
| 0 | 257 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 258 | | } |
| 0 | 259 | | if (vpnServerConfigurationName == null) |
| | 260 | | { |
| 0 | 261 | | throw new ArgumentNullException(nameof(vpnServerConfigurationName)); |
| | 262 | | } |
| 0 | 263 | | if (vpnServerConfigurationParameters == null) |
| | 264 | | { |
| 0 | 265 | | throw new ArgumentNullException(nameof(vpnServerConfigurationParameters)); |
| | 266 | | } |
| | 267 | |
|
| 0 | 268 | | using var message = CreateUpdateTagsRequest(resourceGroupName, vpnServerConfigurationName, vpnServerConfigur |
| 0 | 269 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 270 | | switch (message.Response.Status) |
| | 271 | | { |
| | 272 | | case 200: |
| | 273 | | { |
| 0 | 274 | | VpnServerConfiguration value = default; |
| 0 | 275 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 276 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 277 | | { |
| 0 | 278 | | value = null; |
| | 279 | | } |
| | 280 | | else |
| | 281 | | { |
| 0 | 282 | | value = VpnServerConfiguration.DeserializeVpnServerConfiguration(document.RootElement); |
| | 283 | | } |
| 0 | 284 | | return Response.FromValue(value, message.Response); |
| | 285 | | } |
| | 286 | | default: |
| 0 | 287 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 288 | | } |
| 0 | 289 | | } |
| | 290 | |
|
| | 291 | | /// <summary> Updates VpnServerConfiguration tags. </summary> |
| | 292 | | /// <param name="resourceGroupName"> The resource group name of the VpnServerConfiguration. </param> |
| | 293 | | /// <param name="vpnServerConfigurationName"> The name of the VpnServerConfiguration being updated. </param> |
| | 294 | | /// <param name="vpnServerConfigurationParameters"> Parameters supplied to update VpnServerConfiguration tags. < |
| | 295 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 296 | | public Response<VpnServerConfiguration> UpdateTags(string resourceGroupName, string vpnServerConfigurationName, |
| | 297 | | { |
| 0 | 298 | | if (resourceGroupName == null) |
| | 299 | | { |
| 0 | 300 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 301 | | } |
| 0 | 302 | | if (vpnServerConfigurationName == null) |
| | 303 | | { |
| 0 | 304 | | throw new ArgumentNullException(nameof(vpnServerConfigurationName)); |
| | 305 | | } |
| 0 | 306 | | if (vpnServerConfigurationParameters == null) |
| | 307 | | { |
| 0 | 308 | | throw new ArgumentNullException(nameof(vpnServerConfigurationParameters)); |
| | 309 | | } |
| | 310 | |
|
| 0 | 311 | | using var message = CreateUpdateTagsRequest(resourceGroupName, vpnServerConfigurationName, vpnServerConfigur |
| 0 | 312 | | _pipeline.Send(message, cancellationToken); |
| 0 | 313 | | switch (message.Response.Status) |
| | 314 | | { |
| | 315 | | case 200: |
| | 316 | | { |
| 0 | 317 | | VpnServerConfiguration value = default; |
| 0 | 318 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 319 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 320 | | { |
| 0 | 321 | | value = null; |
| | 322 | | } |
| | 323 | | else |
| | 324 | | { |
| 0 | 325 | | value = VpnServerConfiguration.DeserializeVpnServerConfiguration(document.RootElement); |
| | 326 | | } |
| 0 | 327 | | return Response.FromValue(value, message.Response); |
| | 328 | | } |
| | 329 | | default: |
| 0 | 330 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 331 | | } |
| 0 | 332 | | } |
| | 333 | |
|
| | 334 | | internal HttpMessage CreateDeleteRequest(string resourceGroupName, string vpnServerConfigurationName) |
| | 335 | | { |
| 0 | 336 | | var message = _pipeline.CreateMessage(); |
| 0 | 337 | | var request = message.Request; |
| 0 | 338 | | request.Method = RequestMethod.Delete; |
| 0 | 339 | | var uri = new RawRequestUriBuilder(); |
| 0 | 340 | | uri.Reset(endpoint); |
| 0 | 341 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 342 | | uri.AppendPath(subscriptionId, true); |
| 0 | 343 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 344 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 345 | | uri.AppendPath("/providers/Microsoft.Network/vpnServerConfigurations/", false); |
| 0 | 346 | | uri.AppendPath(vpnServerConfigurationName, true); |
| 0 | 347 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 348 | | request.Uri = uri; |
| 0 | 349 | | return message; |
| | 350 | | } |
| | 351 | |
|
| | 352 | | /// <summary> Deletes a VpnServerConfiguration. </summary> |
| | 353 | | /// <param name="resourceGroupName"> The resource group name of the VpnServerConfiguration. </param> |
| | 354 | | /// <param name="vpnServerConfigurationName"> The name of the VpnServerConfiguration being deleted. </param> |
| | 355 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 356 | | public async Task<Response> DeleteAsync(string resourceGroupName, string vpnServerConfigurationName, Cancellatio |
| | 357 | | { |
| 0 | 358 | | if (resourceGroupName == null) |
| | 359 | | { |
| 0 | 360 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 361 | | } |
| 0 | 362 | | if (vpnServerConfigurationName == null) |
| | 363 | | { |
| 0 | 364 | | throw new ArgumentNullException(nameof(vpnServerConfigurationName)); |
| | 365 | | } |
| | 366 | |
|
| 0 | 367 | | using var message = CreateDeleteRequest(resourceGroupName, vpnServerConfigurationName); |
| 0 | 368 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 369 | | switch (message.Response.Status) |
| | 370 | | { |
| | 371 | | case 200: |
| | 372 | | case 202: |
| | 373 | | case 204: |
| 0 | 374 | | return message.Response; |
| | 375 | | default: |
| 0 | 376 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 377 | | } |
| 0 | 378 | | } |
| | 379 | |
|
| | 380 | | /// <summary> Deletes a VpnServerConfiguration. </summary> |
| | 381 | | /// <param name="resourceGroupName"> The resource group name of the VpnServerConfiguration. </param> |
| | 382 | | /// <param name="vpnServerConfigurationName"> The name of the VpnServerConfiguration being deleted. </param> |
| | 383 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 384 | | public Response Delete(string resourceGroupName, string vpnServerConfigurationName, CancellationToken cancellati |
| | 385 | | { |
| 0 | 386 | | if (resourceGroupName == null) |
| | 387 | | { |
| 0 | 388 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 389 | | } |
| 0 | 390 | | if (vpnServerConfigurationName == null) |
| | 391 | | { |
| 0 | 392 | | throw new ArgumentNullException(nameof(vpnServerConfigurationName)); |
| | 393 | | } |
| | 394 | |
|
| 0 | 395 | | using var message = CreateDeleteRequest(resourceGroupName, vpnServerConfigurationName); |
| 0 | 396 | | _pipeline.Send(message, cancellationToken); |
| 0 | 397 | | switch (message.Response.Status) |
| | 398 | | { |
| | 399 | | case 200: |
| | 400 | | case 202: |
| | 401 | | case 204: |
| 0 | 402 | | return message.Response; |
| | 403 | | default: |
| 0 | 404 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 405 | | } |
| 0 | 406 | | } |
| | 407 | |
|
| | 408 | | internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName) |
| | 409 | | { |
| 0 | 410 | | var message = _pipeline.CreateMessage(); |
| 0 | 411 | | var request = message.Request; |
| 0 | 412 | | request.Method = RequestMethod.Get; |
| 0 | 413 | | var uri = new RawRequestUriBuilder(); |
| 0 | 414 | | uri.Reset(endpoint); |
| 0 | 415 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 416 | | uri.AppendPath(subscriptionId, true); |
| 0 | 417 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 418 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 419 | | uri.AppendPath("/providers/Microsoft.Network/vpnServerConfigurations", false); |
| 0 | 420 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 421 | | request.Uri = uri; |
| 0 | 422 | | return message; |
| | 423 | | } |
| | 424 | |
|
| | 425 | | /// <summary> Lists all the vpnServerConfigurations in a resource group. </summary> |
| | 426 | | /// <param name="resourceGroupName"> The resource group name of the VpnServerConfiguration. </param> |
| | 427 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 428 | | public async Task<Response<ListVpnServerConfigurationsResult>> ListByResourceGroupAsync(string resourceGroupName |
| | 429 | | { |
| 0 | 430 | | if (resourceGroupName == null) |
| | 431 | | { |
| 0 | 432 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 433 | | } |
| | 434 | |
|
| 0 | 435 | | using var message = CreateListByResourceGroupRequest(resourceGroupName); |
| 0 | 436 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 437 | | switch (message.Response.Status) |
| | 438 | | { |
| | 439 | | case 200: |
| | 440 | | { |
| 0 | 441 | | ListVpnServerConfigurationsResult value = default; |
| 0 | 442 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 443 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 444 | | { |
| 0 | 445 | | value = null; |
| | 446 | | } |
| | 447 | | else |
| | 448 | | { |
| 0 | 449 | | value = ListVpnServerConfigurationsResult.DeserializeListVpnServerConfigurationsResult(docum |
| | 450 | | } |
| 0 | 451 | | return Response.FromValue(value, message.Response); |
| | 452 | | } |
| | 453 | | default: |
| 0 | 454 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 455 | | } |
| 0 | 456 | | } |
| | 457 | |
|
| | 458 | | /// <summary> Lists all the vpnServerConfigurations in a resource group. </summary> |
| | 459 | | /// <param name="resourceGroupName"> The resource group name of the VpnServerConfiguration. </param> |
| | 460 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 461 | | public Response<ListVpnServerConfigurationsResult> ListByResourceGroup(string resourceGroupName, CancellationTok |
| | 462 | | { |
| 0 | 463 | | if (resourceGroupName == null) |
| | 464 | | { |
| 0 | 465 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 466 | | } |
| | 467 | |
|
| 0 | 468 | | using var message = CreateListByResourceGroupRequest(resourceGroupName); |
| 0 | 469 | | _pipeline.Send(message, cancellationToken); |
| 0 | 470 | | switch (message.Response.Status) |
| | 471 | | { |
| | 472 | | case 200: |
| | 473 | | { |
| 0 | 474 | | ListVpnServerConfigurationsResult value = default; |
| 0 | 475 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 476 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 477 | | { |
| 0 | 478 | | value = null; |
| | 479 | | } |
| | 480 | | else |
| | 481 | | { |
| 0 | 482 | | value = ListVpnServerConfigurationsResult.DeserializeListVpnServerConfigurationsResult(docum |
| | 483 | | } |
| 0 | 484 | | return Response.FromValue(value, message.Response); |
| | 485 | | } |
| | 486 | | default: |
| 0 | 487 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 488 | | } |
| 0 | 489 | | } |
| | 490 | |
|
| | 491 | | internal HttpMessage CreateListRequest() |
| | 492 | | { |
| 0 | 493 | | var message = _pipeline.CreateMessage(); |
| 0 | 494 | | var request = message.Request; |
| 0 | 495 | | request.Method = RequestMethod.Get; |
| 0 | 496 | | var uri = new RawRequestUriBuilder(); |
| 0 | 497 | | uri.Reset(endpoint); |
| 0 | 498 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 499 | | uri.AppendPath(subscriptionId, true); |
| 0 | 500 | | uri.AppendPath("/providers/Microsoft.Network/vpnServerConfigurations", false); |
| 0 | 501 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 502 | | request.Uri = uri; |
| 0 | 503 | | return message; |
| | 504 | | } |
| | 505 | |
|
| | 506 | | /// <summary> Lists all the VpnServerConfigurations in a subscription. </summary> |
| | 507 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 508 | | public async Task<Response<ListVpnServerConfigurationsResult>> ListAsync(CancellationToken cancellationToken = d |
| | 509 | | { |
| 0 | 510 | | using var message = CreateListRequest(); |
| 0 | 511 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 512 | | switch (message.Response.Status) |
| | 513 | | { |
| | 514 | | case 200: |
| | 515 | | { |
| 0 | 516 | | ListVpnServerConfigurationsResult value = default; |
| 0 | 517 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 518 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 519 | | { |
| 0 | 520 | | value = null; |
| | 521 | | } |
| | 522 | | else |
| | 523 | | { |
| 0 | 524 | | value = ListVpnServerConfigurationsResult.DeserializeListVpnServerConfigurationsResult(docum |
| | 525 | | } |
| 0 | 526 | | return Response.FromValue(value, message.Response); |
| | 527 | | } |
| | 528 | | default: |
| 0 | 529 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 530 | | } |
| 0 | 531 | | } |
| | 532 | |
|
| | 533 | | /// <summary> Lists all the VpnServerConfigurations in a subscription. </summary> |
| | 534 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 535 | | public Response<ListVpnServerConfigurationsResult> List(CancellationToken cancellationToken = default) |
| | 536 | | { |
| 0 | 537 | | using var message = CreateListRequest(); |
| 0 | 538 | | _pipeline.Send(message, cancellationToken); |
| 0 | 539 | | switch (message.Response.Status) |
| | 540 | | { |
| | 541 | | case 200: |
| | 542 | | { |
| 0 | 543 | | ListVpnServerConfigurationsResult value = default; |
| 0 | 544 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 545 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 546 | | { |
| 0 | 547 | | value = null; |
| | 548 | | } |
| | 549 | | else |
| | 550 | | { |
| 0 | 551 | | value = ListVpnServerConfigurationsResult.DeserializeListVpnServerConfigurationsResult(docum |
| | 552 | | } |
| 0 | 553 | | return Response.FromValue(value, message.Response); |
| | 554 | | } |
| | 555 | | default: |
| 0 | 556 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 557 | | } |
| 0 | 558 | | } |
| | 559 | |
|
| | 560 | | internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName) |
| | 561 | | { |
| 0 | 562 | | var message = _pipeline.CreateMessage(); |
| 0 | 563 | | var request = message.Request; |
| 0 | 564 | | request.Method = RequestMethod.Get; |
| 0 | 565 | | var uri = new RawRequestUriBuilder(); |
| 0 | 566 | | uri.Reset(endpoint); |
| 0 | 567 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 568 | | request.Uri = uri; |
| 0 | 569 | | return message; |
| | 570 | | } |
| | 571 | |
|
| | 572 | | /// <summary> Lists all the vpnServerConfigurations in a resource group. </summary> |
| | 573 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 574 | | /// <param name="resourceGroupName"> The resource group name of the VpnServerConfiguration. </param> |
| | 575 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 576 | | public async Task<Response<ListVpnServerConfigurationsResult>> ListByResourceGroupNextPageAsync(string nextLink, |
| | 577 | | { |
| 0 | 578 | | if (nextLink == null) |
| | 579 | | { |
| 0 | 580 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 581 | | } |
| 0 | 582 | | if (resourceGroupName == null) |
| | 583 | | { |
| 0 | 584 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 585 | | } |
| | 586 | |
|
| 0 | 587 | | using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); |
| 0 | 588 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 589 | | switch (message.Response.Status) |
| | 590 | | { |
| | 591 | | case 200: |
| | 592 | | { |
| 0 | 593 | | ListVpnServerConfigurationsResult value = default; |
| 0 | 594 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 595 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 596 | | { |
| 0 | 597 | | value = null; |
| | 598 | | } |
| | 599 | | else |
| | 600 | | { |
| 0 | 601 | | value = ListVpnServerConfigurationsResult.DeserializeListVpnServerConfigurationsResult(docum |
| | 602 | | } |
| 0 | 603 | | return Response.FromValue(value, message.Response); |
| | 604 | | } |
| | 605 | | default: |
| 0 | 606 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 607 | | } |
| 0 | 608 | | } |
| | 609 | |
|
| | 610 | | /// <summary> Lists all the vpnServerConfigurations in a resource group. </summary> |
| | 611 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 612 | | /// <param name="resourceGroupName"> The resource group name of the VpnServerConfiguration. </param> |
| | 613 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 614 | | public Response<ListVpnServerConfigurationsResult> ListByResourceGroupNextPage(string nextLink, string resourceG |
| | 615 | | { |
| 0 | 616 | | if (nextLink == null) |
| | 617 | | { |
| 0 | 618 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 619 | | } |
| 0 | 620 | | if (resourceGroupName == null) |
| | 621 | | { |
| 0 | 622 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 623 | | } |
| | 624 | |
|
| 0 | 625 | | using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); |
| 0 | 626 | | _pipeline.Send(message, cancellationToken); |
| 0 | 627 | | switch (message.Response.Status) |
| | 628 | | { |
| | 629 | | case 200: |
| | 630 | | { |
| 0 | 631 | | ListVpnServerConfigurationsResult value = default; |
| 0 | 632 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 633 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 634 | | { |
| 0 | 635 | | value = null; |
| | 636 | | } |
| | 637 | | else |
| | 638 | | { |
| 0 | 639 | | value = ListVpnServerConfigurationsResult.DeserializeListVpnServerConfigurationsResult(docum |
| | 640 | | } |
| 0 | 641 | | return Response.FromValue(value, message.Response); |
| | 642 | | } |
| | 643 | | default: |
| 0 | 644 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 645 | | } |
| 0 | 646 | | } |
| | 647 | |
|
| | 648 | | internal HttpMessage CreateListNextPageRequest(string nextLink) |
| | 649 | | { |
| 0 | 650 | | var message = _pipeline.CreateMessage(); |
| 0 | 651 | | var request = message.Request; |
| 0 | 652 | | request.Method = RequestMethod.Get; |
| 0 | 653 | | var uri = new RawRequestUriBuilder(); |
| 0 | 654 | | uri.Reset(endpoint); |
| 0 | 655 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 656 | | request.Uri = uri; |
| 0 | 657 | | return message; |
| | 658 | | } |
| | 659 | |
|
| | 660 | | /// <summary> Lists all the VpnServerConfigurations in a subscription. </summary> |
| | 661 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 662 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 663 | | public async Task<Response<ListVpnServerConfigurationsResult>> ListNextPageAsync(string nextLink, CancellationTo |
| | 664 | | { |
| 0 | 665 | | if (nextLink == null) |
| | 666 | | { |
| 0 | 667 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 668 | | } |
| | 669 | |
|
| 0 | 670 | | using var message = CreateListNextPageRequest(nextLink); |
| 0 | 671 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 672 | | switch (message.Response.Status) |
| | 673 | | { |
| | 674 | | case 200: |
| | 675 | | { |
| 0 | 676 | | ListVpnServerConfigurationsResult value = default; |
| 0 | 677 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 678 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 679 | | { |
| 0 | 680 | | value = null; |
| | 681 | | } |
| | 682 | | else |
| | 683 | | { |
| 0 | 684 | | value = ListVpnServerConfigurationsResult.DeserializeListVpnServerConfigurationsResult(docum |
| | 685 | | } |
| 0 | 686 | | return Response.FromValue(value, message.Response); |
| | 687 | | } |
| | 688 | | default: |
| 0 | 689 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 690 | | } |
| 0 | 691 | | } |
| | 692 | |
|
| | 693 | | /// <summary> Lists all the VpnServerConfigurations in a subscription. </summary> |
| | 694 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 695 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 696 | | public Response<ListVpnServerConfigurationsResult> ListNextPage(string nextLink, CancellationToken cancellationT |
| | 697 | | { |
| 0 | 698 | | if (nextLink == null) |
| | 699 | | { |
| 0 | 700 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 701 | | } |
| | 702 | |
|
| 0 | 703 | | using var message = CreateListNextPageRequest(nextLink); |
| 0 | 704 | | _pipeline.Send(message, cancellationToken); |
| 0 | 705 | | switch (message.Response.Status) |
| | 706 | | { |
| | 707 | | case 200: |
| | 708 | | { |
| 0 | 709 | | ListVpnServerConfigurationsResult value = default; |
| 0 | 710 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 711 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 712 | | { |
| 0 | 713 | | value = null; |
| | 714 | | } |
| | 715 | | else |
| | 716 | | { |
| 0 | 717 | | value = ListVpnServerConfigurationsResult.DeserializeListVpnServerConfigurationsResult(docum |
| | 718 | | } |
| 0 | 719 | | return Response.FromValue(value, message.Response); |
| | 720 | | } |
| | 721 | | default: |
| 0 | 722 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 723 | | } |
| 0 | 724 | | } |
| | 725 | | } |
| | 726 | | } |