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