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