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