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