| | 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 ServiceEndpointPolicyDefinitionsRestOperations |
| | 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 ServiceEndpointPolicyDefinitionsRestOperations. </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 ServiceEndpointPolicyDefinitionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline |
| | 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, string serv |
| | 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.AppendPath("/serviceEndpointPolicyDefinitions/", false); |
| 0 | 60 | | uri.AppendPath(serviceEndpointPolicyDefinitionName, true); |
| 0 | 61 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 62 | | request.Uri = uri; |
| 0 | 63 | | return message; |
| | 64 | | } |
| | 65 | |
|
| | 66 | | /// <summary> Deletes the specified ServiceEndpoint policy definitions. </summary> |
| | 67 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 68 | | /// <param name="serviceEndpointPolicyName"> The name of the Service Endpoint Policy. </param> |
| | 69 | | /// <param name="serviceEndpointPolicyDefinitionName"> The name of the service endpoint policy definition. </par |
| | 70 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 71 | | public async Task<Response> DeleteAsync(string resourceGroupName, string serviceEndpointPolicyName, string servi |
| | 72 | | { |
| 0 | 73 | | if (resourceGroupName == null) |
| | 74 | | { |
| 0 | 75 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 76 | | } |
| 0 | 77 | | if (serviceEndpointPolicyName == null) |
| | 78 | | { |
| 0 | 79 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyName)); |
| | 80 | | } |
| 0 | 81 | | if (serviceEndpointPolicyDefinitionName == null) |
| | 82 | | { |
| 0 | 83 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyDefinitionName)); |
| | 84 | | } |
| | 85 | |
|
| 0 | 86 | | using var message = CreateDeleteRequest(resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyD |
| 0 | 87 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 88 | | switch (message.Response.Status) |
| | 89 | | { |
| | 90 | | case 200: |
| | 91 | | case 202: |
| | 92 | | case 204: |
| 0 | 93 | | return message.Response; |
| | 94 | | default: |
| 0 | 95 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 96 | | } |
| 0 | 97 | | } |
| | 98 | |
|
| | 99 | | /// <summary> Deletes the specified ServiceEndpoint policy definitions. </summary> |
| | 100 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 101 | | /// <param name="serviceEndpointPolicyName"> The name of the Service Endpoint Policy. </param> |
| | 102 | | /// <param name="serviceEndpointPolicyDefinitionName"> The name of the service endpoint policy definition. </par |
| | 103 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 104 | | public Response Delete(string resourceGroupName, string serviceEndpointPolicyName, string serviceEndpointPolicyD |
| | 105 | | { |
| 0 | 106 | | if (resourceGroupName == null) |
| | 107 | | { |
| 0 | 108 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 109 | | } |
| 0 | 110 | | if (serviceEndpointPolicyName == null) |
| | 111 | | { |
| 0 | 112 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyName)); |
| | 113 | | } |
| 0 | 114 | | if (serviceEndpointPolicyDefinitionName == null) |
| | 115 | | { |
| 0 | 116 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyDefinitionName)); |
| | 117 | | } |
| | 118 | |
|
| 0 | 119 | | using var message = CreateDeleteRequest(resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyD |
| 0 | 120 | | _pipeline.Send(message, cancellationToken); |
| 0 | 121 | | switch (message.Response.Status) |
| | 122 | | { |
| | 123 | | case 200: |
| | 124 | | case 202: |
| | 125 | | case 204: |
| 0 | 126 | | return message.Response; |
| | 127 | | default: |
| 0 | 128 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 129 | | } |
| 0 | 130 | | } |
| | 131 | |
|
| | 132 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string serviceEndpointPolicyName, string service |
| | 133 | | { |
| 0 | 134 | | var message = _pipeline.CreateMessage(); |
| 0 | 135 | | var request = message.Request; |
| 0 | 136 | | request.Method = RequestMethod.Get; |
| 0 | 137 | | var uri = new RawRequestUriBuilder(); |
| 0 | 138 | | uri.Reset(endpoint); |
| 0 | 139 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 140 | | uri.AppendPath(subscriptionId, true); |
| 0 | 141 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 142 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 143 | | uri.AppendPath("/providers/Microsoft.Network/serviceEndpointPolicies/", false); |
| 0 | 144 | | uri.AppendPath(serviceEndpointPolicyName, true); |
| 0 | 145 | | uri.AppendPath("/serviceEndpointPolicyDefinitions/", false); |
| 0 | 146 | | uri.AppendPath(serviceEndpointPolicyDefinitionName, true); |
| 0 | 147 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 148 | | request.Uri = uri; |
| 0 | 149 | | return message; |
| | 150 | | } |
| | 151 | |
|
| | 152 | | /// <summary> Get the specified service endpoint policy definitions from service endpoint policy. </summary> |
| | 153 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 154 | | /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy name. </param> |
| | 155 | | /// <param name="serviceEndpointPolicyDefinitionName"> The name of the service endpoint policy definition name. |
| | 156 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 157 | | public async Task<Response<ServiceEndpointPolicyDefinition>> GetAsync(string resourceGroupName, string serviceEn |
| | 158 | | { |
| 0 | 159 | | if (resourceGroupName == null) |
| | 160 | | { |
| 0 | 161 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 162 | | } |
| 0 | 163 | | if (serviceEndpointPolicyName == null) |
| | 164 | | { |
| 0 | 165 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyName)); |
| | 166 | | } |
| 0 | 167 | | if (serviceEndpointPolicyDefinitionName == null) |
| | 168 | | { |
| 0 | 169 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyDefinitionName)); |
| | 170 | | } |
| | 171 | |
|
| 0 | 172 | | using var message = CreateGetRequest(resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefi |
| 0 | 173 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 174 | | switch (message.Response.Status) |
| | 175 | | { |
| | 176 | | case 200: |
| | 177 | | { |
| 0 | 178 | | ServiceEndpointPolicyDefinition value = default; |
| 0 | 179 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 180 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 181 | | { |
| 0 | 182 | | value = null; |
| | 183 | | } |
| | 184 | | else |
| | 185 | | { |
| 0 | 186 | | value = ServiceEndpointPolicyDefinition.DeserializeServiceEndpointPolicyDefinition(document. |
| | 187 | | } |
| 0 | 188 | | return Response.FromValue(value, message.Response); |
| | 189 | | } |
| | 190 | | default: |
| 0 | 191 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 192 | | } |
| 0 | 193 | | } |
| | 194 | |
|
| | 195 | | /// <summary> Get the specified service endpoint policy definitions from service endpoint policy. </summary> |
| | 196 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 197 | | /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy name. </param> |
| | 198 | | /// <param name="serviceEndpointPolicyDefinitionName"> The name of the service endpoint policy definition name. |
| | 199 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 200 | | public Response<ServiceEndpointPolicyDefinition> Get(string resourceGroupName, string serviceEndpointPolicyName, |
| | 201 | | { |
| 0 | 202 | | if (resourceGroupName == null) |
| | 203 | | { |
| 0 | 204 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 205 | | } |
| 0 | 206 | | if (serviceEndpointPolicyName == null) |
| | 207 | | { |
| 0 | 208 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyName)); |
| | 209 | | } |
| 0 | 210 | | if (serviceEndpointPolicyDefinitionName == null) |
| | 211 | | { |
| 0 | 212 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyDefinitionName)); |
| | 213 | | } |
| | 214 | |
|
| 0 | 215 | | using var message = CreateGetRequest(resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefi |
| 0 | 216 | | _pipeline.Send(message, cancellationToken); |
| 0 | 217 | | switch (message.Response.Status) |
| | 218 | | { |
| | 219 | | case 200: |
| | 220 | | { |
| 0 | 221 | | ServiceEndpointPolicyDefinition value = default; |
| 0 | 222 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 223 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 224 | | { |
| 0 | 225 | | value = null; |
| | 226 | | } |
| | 227 | | else |
| | 228 | | { |
| 0 | 229 | | value = ServiceEndpointPolicyDefinition.DeserializeServiceEndpointPolicyDefinition(document. |
| | 230 | | } |
| 0 | 231 | | return Response.FromValue(value, message.Response); |
| | 232 | | } |
| | 233 | | default: |
| 0 | 234 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 235 | | } |
| 0 | 236 | | } |
| | 237 | |
|
| | 238 | | internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string serviceEndpointPolicyName, str |
| | 239 | | { |
| 0 | 240 | | var message = _pipeline.CreateMessage(); |
| 0 | 241 | | var request = message.Request; |
| 0 | 242 | | request.Method = RequestMethod.Put; |
| 0 | 243 | | var uri = new RawRequestUriBuilder(); |
| 0 | 244 | | uri.Reset(endpoint); |
| 0 | 245 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 246 | | uri.AppendPath(subscriptionId, true); |
| 0 | 247 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 248 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 249 | | uri.AppendPath("/providers/Microsoft.Network/serviceEndpointPolicies/", false); |
| 0 | 250 | | uri.AppendPath(serviceEndpointPolicyName, true); |
| 0 | 251 | | uri.AppendPath("/serviceEndpointPolicyDefinitions/", false); |
| 0 | 252 | | uri.AppendPath(serviceEndpointPolicyDefinitionName, true); |
| 0 | 253 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 254 | | request.Uri = uri; |
| 0 | 255 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 256 | | var content = new Utf8JsonRequestContent(); |
| 0 | 257 | | content.JsonWriter.WriteObjectValue(serviceEndpointPolicyDefinitions); |
| 0 | 258 | | request.Content = content; |
| 0 | 259 | | return message; |
| | 260 | | } |
| | 261 | |
|
| | 262 | | /// <summary> Creates or updates a service endpoint policy definition in the specified service endpoint policy. |
| | 263 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 264 | | /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy. </param> |
| | 265 | | /// <param name="serviceEndpointPolicyDefinitionName"> The name of the service endpoint policy definition name. |
| | 266 | | /// <param name="serviceEndpointPolicyDefinitions"> Parameters supplied to the create or update service endpoint |
| | 267 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 268 | | public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string serviceEndpointPolicyName, stri |
| | 269 | | { |
| 0 | 270 | | if (resourceGroupName == null) |
| | 271 | | { |
| 0 | 272 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 273 | | } |
| 0 | 274 | | if (serviceEndpointPolicyName == null) |
| | 275 | | { |
| 0 | 276 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyName)); |
| | 277 | | } |
| 0 | 278 | | if (serviceEndpointPolicyDefinitionName == null) |
| | 279 | | { |
| 0 | 280 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyDefinitionName)); |
| | 281 | | } |
| 0 | 282 | | if (serviceEndpointPolicyDefinitions == null) |
| | 283 | | { |
| 0 | 284 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyDefinitions)); |
| | 285 | | } |
| | 286 | |
|
| 0 | 287 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, serviceEndpointPolicyName, serviceEndpoin |
| 0 | 288 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 289 | | switch (message.Response.Status) |
| | 290 | | { |
| | 291 | | case 200: |
| | 292 | | case 201: |
| 0 | 293 | | return message.Response; |
| | 294 | | default: |
| 0 | 295 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 296 | | } |
| 0 | 297 | | } |
| | 298 | |
|
| | 299 | | /// <summary> Creates or updates a service endpoint policy definition in the specified service endpoint policy. |
| | 300 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 301 | | /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy. </param> |
| | 302 | | /// <param name="serviceEndpointPolicyDefinitionName"> The name of the service endpoint policy definition name. |
| | 303 | | /// <param name="serviceEndpointPolicyDefinitions"> Parameters supplied to the create or update service endpoint |
| | 304 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 305 | | public Response CreateOrUpdate(string resourceGroupName, string serviceEndpointPolicyName, string serviceEndpoin |
| | 306 | | { |
| 0 | 307 | | if (resourceGroupName == null) |
| | 308 | | { |
| 0 | 309 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 310 | | } |
| 0 | 311 | | if (serviceEndpointPolicyName == null) |
| | 312 | | { |
| 0 | 313 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyName)); |
| | 314 | | } |
| 0 | 315 | | if (serviceEndpointPolicyDefinitionName == null) |
| | 316 | | { |
| 0 | 317 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyDefinitionName)); |
| | 318 | | } |
| 0 | 319 | | if (serviceEndpointPolicyDefinitions == null) |
| | 320 | | { |
| 0 | 321 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyDefinitions)); |
| | 322 | | } |
| | 323 | |
|
| 0 | 324 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, serviceEndpointPolicyName, serviceEndpoin |
| 0 | 325 | | _pipeline.Send(message, cancellationToken); |
| 0 | 326 | | switch (message.Response.Status) |
| | 327 | | { |
| | 328 | | case 200: |
| | 329 | | case 201: |
| 0 | 330 | | return message.Response; |
| | 331 | | default: |
| 0 | 332 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 333 | | } |
| 0 | 334 | | } |
| | 335 | |
|
| | 336 | | internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName, string serviceEndpointPolicyName |
| | 337 | | { |
| 0 | 338 | | var message = _pipeline.CreateMessage(); |
| 0 | 339 | | var request = message.Request; |
| 0 | 340 | | request.Method = RequestMethod.Get; |
| 0 | 341 | | var uri = new RawRequestUriBuilder(); |
| 0 | 342 | | uri.Reset(endpoint); |
| 0 | 343 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 344 | | uri.AppendPath(subscriptionId, true); |
| 0 | 345 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 346 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 347 | | uri.AppendPath("/providers/Microsoft.Network/serviceEndpointPolicies/", false); |
| 0 | 348 | | uri.AppendPath(serviceEndpointPolicyName, true); |
| 0 | 349 | | uri.AppendPath("/serviceEndpointPolicyDefinitions", false); |
| 0 | 350 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 351 | | request.Uri = uri; |
| 0 | 352 | | return message; |
| | 353 | | } |
| | 354 | |
|
| | 355 | | /// <summary> Gets all service endpoint policy definitions in a service end point policy. </summary> |
| | 356 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 357 | | /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy name. </param> |
| | 358 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 359 | | public async Task<Response<ServiceEndpointPolicyDefinitionListResult>> ListByResourceGroupAsync(string resourceG |
| | 360 | | { |
| 0 | 361 | | if (resourceGroupName == null) |
| | 362 | | { |
| 0 | 363 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 364 | | } |
| 0 | 365 | | if (serviceEndpointPolicyName == null) |
| | 366 | | { |
| 0 | 367 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyName)); |
| | 368 | | } |
| | 369 | |
|
| 0 | 370 | | using var message = CreateListByResourceGroupRequest(resourceGroupName, serviceEndpointPolicyName); |
| 0 | 371 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 372 | | switch (message.Response.Status) |
| | 373 | | { |
| | 374 | | case 200: |
| | 375 | | { |
| 0 | 376 | | ServiceEndpointPolicyDefinitionListResult value = default; |
| 0 | 377 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 378 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 379 | | { |
| 0 | 380 | | value = null; |
| | 381 | | } |
| | 382 | | else |
| | 383 | | { |
| 0 | 384 | | value = ServiceEndpointPolicyDefinitionListResult.DeserializeServiceEndpointPolicyDefinition |
| | 385 | | } |
| 0 | 386 | | return Response.FromValue(value, message.Response); |
| | 387 | | } |
| | 388 | | default: |
| 0 | 389 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 390 | | } |
| 0 | 391 | | } |
| | 392 | |
|
| | 393 | | /// <summary> Gets all service endpoint policy definitions in a service end point policy. </summary> |
| | 394 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 395 | | /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy name. </param> |
| | 396 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 397 | | public Response<ServiceEndpointPolicyDefinitionListResult> ListByResourceGroup(string resourceGroupName, string |
| | 398 | | { |
| 0 | 399 | | if (resourceGroupName == null) |
| | 400 | | { |
| 0 | 401 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 402 | | } |
| 0 | 403 | | if (serviceEndpointPolicyName == null) |
| | 404 | | { |
| 0 | 405 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyName)); |
| | 406 | | } |
| | 407 | |
|
| 0 | 408 | | using var message = CreateListByResourceGroupRequest(resourceGroupName, serviceEndpointPolicyName); |
| 0 | 409 | | _pipeline.Send(message, cancellationToken); |
| 0 | 410 | | switch (message.Response.Status) |
| | 411 | | { |
| | 412 | | case 200: |
| | 413 | | { |
| 0 | 414 | | ServiceEndpointPolicyDefinitionListResult value = default; |
| 0 | 415 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 416 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 417 | | { |
| 0 | 418 | | value = null; |
| | 419 | | } |
| | 420 | | else |
| | 421 | | { |
| 0 | 422 | | value = ServiceEndpointPolicyDefinitionListResult.DeserializeServiceEndpointPolicyDefinition |
| | 423 | | } |
| 0 | 424 | | return Response.FromValue(value, message.Response); |
| | 425 | | } |
| | 426 | | default: |
| 0 | 427 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 428 | | } |
| 0 | 429 | | } |
| | 430 | |
|
| | 431 | | internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName, string |
| | 432 | | { |
| 0 | 433 | | var message = _pipeline.CreateMessage(); |
| 0 | 434 | | var request = message.Request; |
| 0 | 435 | | request.Method = RequestMethod.Get; |
| 0 | 436 | | var uri = new RawRequestUriBuilder(); |
| 0 | 437 | | uri.Reset(endpoint); |
| 0 | 438 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 439 | | request.Uri = uri; |
| 0 | 440 | | return message; |
| | 441 | | } |
| | 442 | |
|
| | 443 | | /// <summary> Gets all service endpoint policy definitions in a service end point policy. </summary> |
| | 444 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 445 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 446 | | /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy name. </param> |
| | 447 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 448 | | public async Task<Response<ServiceEndpointPolicyDefinitionListResult>> ListByResourceGroupNextPageAsync(string n |
| | 449 | | { |
| 0 | 450 | | if (nextLink == null) |
| | 451 | | { |
| 0 | 452 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 453 | | } |
| 0 | 454 | | if (resourceGroupName == null) |
| | 455 | | { |
| 0 | 456 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 457 | | } |
| 0 | 458 | | if (serviceEndpointPolicyName == null) |
| | 459 | | { |
| 0 | 460 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyName)); |
| | 461 | | } |
| | 462 | |
|
| 0 | 463 | | using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName, serviceEndpointPol |
| 0 | 464 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 465 | | switch (message.Response.Status) |
| | 466 | | { |
| | 467 | | case 200: |
| | 468 | | { |
| 0 | 469 | | ServiceEndpointPolicyDefinitionListResult value = default; |
| 0 | 470 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 471 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 472 | | { |
| 0 | 473 | | value = null; |
| | 474 | | } |
| | 475 | | else |
| | 476 | | { |
| 0 | 477 | | value = ServiceEndpointPolicyDefinitionListResult.DeserializeServiceEndpointPolicyDefinition |
| | 478 | | } |
| 0 | 479 | | return Response.FromValue(value, message.Response); |
| | 480 | | } |
| | 481 | | default: |
| 0 | 482 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 483 | | } |
| 0 | 484 | | } |
| | 485 | |
|
| | 486 | | /// <summary> Gets all service endpoint policy definitions in a service end point policy. </summary> |
| | 487 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 488 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 489 | | /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy name. </param> |
| | 490 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 491 | | public Response<ServiceEndpointPolicyDefinitionListResult> ListByResourceGroupNextPage(string nextLink, string r |
| | 492 | | { |
| 0 | 493 | | if (nextLink == null) |
| | 494 | | { |
| 0 | 495 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 496 | | } |
| 0 | 497 | | if (resourceGroupName == null) |
| | 498 | | { |
| 0 | 499 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 500 | | } |
| 0 | 501 | | if (serviceEndpointPolicyName == null) |
| | 502 | | { |
| 0 | 503 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyName)); |
| | 504 | | } |
| | 505 | |
|
| 0 | 506 | | using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName, serviceEndpointPol |
| 0 | 507 | | _pipeline.Send(message, cancellationToken); |
| 0 | 508 | | switch (message.Response.Status) |
| | 509 | | { |
| | 510 | | case 200: |
| | 511 | | { |
| 0 | 512 | | ServiceEndpointPolicyDefinitionListResult value = default; |
| 0 | 513 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 514 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 515 | | { |
| 0 | 516 | | value = null; |
| | 517 | | } |
| | 518 | | else |
| | 519 | | { |
| 0 | 520 | | value = ServiceEndpointPolicyDefinitionListResult.DeserializeServiceEndpointPolicyDefinition |
| | 521 | | } |
| 0 | 522 | | return Response.FromValue(value, message.Response); |
| | 523 | | } |
| | 524 | | default: |
| 0 | 525 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 526 | | } |
| 0 | 527 | | } |
| | 528 | | } |
| | 529 | | } |