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