| | 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 DedicatedHostsRestOperations |
| | 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 DedicatedHostsRestOperations. </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 DedicatedHostsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscript |
| | 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, string hostName |
| | 47 | | { |
| 8 | 48 | | var message = _pipeline.CreateMessage(); |
| 8 | 49 | | var request = message.Request; |
| 8 | 50 | | request.Method = RequestMethod.Put; |
| 8 | 51 | | var uri = new RawRequestUriBuilder(); |
| 8 | 52 | | uri.Reset(endpoint); |
| 8 | 53 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 54 | | uri.AppendPath(subscriptionId, true); |
| 8 | 55 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 56 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 57 | | uri.AppendPath("/providers/Microsoft.Compute/hostGroups/", false); |
| 8 | 58 | | uri.AppendPath(hostGroupName, true); |
| 8 | 59 | | uri.AppendPath("/hosts/", false); |
| 8 | 60 | | uri.AppendPath(hostName, true); |
| 8 | 61 | | uri.AppendQuery("api-version", "2019-12-01", true); |
| 8 | 62 | | request.Uri = uri; |
| 8 | 63 | | request.Headers.Add("Content-Type", "application/json"); |
| 8 | 64 | | var content = new Utf8JsonRequestContent(); |
| 8 | 65 | | content.JsonWriter.WriteObjectValue(parameters); |
| 8 | 66 | | request.Content = content; |
| 8 | 67 | | return message; |
| | 68 | | } |
| | 69 | |
|
| | 70 | | /// <summary> Create or update a dedicated host . </summary> |
| | 71 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 72 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 73 | | /// <param name="hostName"> The name of the dedicated host . </param> |
| | 74 | | /// <param name="parameters"> Parameters supplied to the Create Dedicated Host. </param> |
| | 75 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 76 | | public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string hostGroupName, string hostName, |
| | 77 | | { |
| 2 | 78 | | if (resourceGroupName == null) |
| | 79 | | { |
| 0 | 80 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 81 | | } |
| 2 | 82 | | if (hostGroupName == null) |
| | 83 | | { |
| 0 | 84 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 85 | | } |
| 2 | 86 | | if (hostName == null) |
| | 87 | | { |
| 0 | 88 | | throw new ArgumentNullException(nameof(hostName)); |
| | 89 | | } |
| 2 | 90 | | if (parameters == null) |
| | 91 | | { |
| 0 | 92 | | throw new ArgumentNullException(nameof(parameters)); |
| | 93 | | } |
| | 94 | |
|
| 2 | 95 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, hostGroupName, hostName, parameters); |
| 2 | 96 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 97 | | switch (message.Response.Status) |
| | 98 | | { |
| | 99 | | case 200: |
| | 100 | | case 201: |
| 2 | 101 | | return message.Response; |
| | 102 | | default: |
| 0 | 103 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 104 | | } |
| 2 | 105 | | } |
| | 106 | |
|
| | 107 | | /// <summary> Create or update a dedicated host . </summary> |
| | 108 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 109 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 110 | | /// <param name="hostName"> The name of the dedicated host . </param> |
| | 111 | | /// <param name="parameters"> Parameters supplied to the Create Dedicated Host. </param> |
| | 112 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 113 | | public Response CreateOrUpdate(string resourceGroupName, string hostGroupName, string hostName, DedicatedHost pa |
| | 114 | | { |
| 2 | 115 | | if (resourceGroupName == null) |
| | 116 | | { |
| 0 | 117 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 118 | | } |
| 2 | 119 | | if (hostGroupName == null) |
| | 120 | | { |
| 0 | 121 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 122 | | } |
| 2 | 123 | | if (hostName == null) |
| | 124 | | { |
| 0 | 125 | | throw new ArgumentNullException(nameof(hostName)); |
| | 126 | | } |
| 2 | 127 | | if (parameters == null) |
| | 128 | | { |
| 0 | 129 | | throw new ArgumentNullException(nameof(parameters)); |
| | 130 | | } |
| | 131 | |
|
| 2 | 132 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, hostGroupName, hostName, parameters); |
| 2 | 133 | | _pipeline.Send(message, cancellationToken); |
| 2 | 134 | | switch (message.Response.Status) |
| | 135 | | { |
| | 136 | | case 200: |
| | 137 | | case 201: |
| 2 | 138 | | return message.Response; |
| | 139 | | default: |
| 0 | 140 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 141 | | } |
| 2 | 142 | | } |
| | 143 | |
|
| | 144 | | internal HttpMessage CreateUpdateRequest(string resourceGroupName, string hostGroupName, string hostName, Dedica |
| | 145 | | { |
| 0 | 146 | | var message = _pipeline.CreateMessage(); |
| 0 | 147 | | var request = message.Request; |
| 0 | 148 | | request.Method = RequestMethod.Patch; |
| 0 | 149 | | var uri = new RawRequestUriBuilder(); |
| 0 | 150 | | uri.Reset(endpoint); |
| 0 | 151 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 152 | | uri.AppendPath(subscriptionId, true); |
| 0 | 153 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 154 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 155 | | uri.AppendPath("/providers/Microsoft.Compute/hostGroups/", false); |
| 0 | 156 | | uri.AppendPath(hostGroupName, true); |
| 0 | 157 | | uri.AppendPath("/hosts/", false); |
| 0 | 158 | | uri.AppendPath(hostName, true); |
| 0 | 159 | | uri.AppendQuery("api-version", "2019-12-01", true); |
| 0 | 160 | | request.Uri = uri; |
| 0 | 161 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 162 | | var content = new Utf8JsonRequestContent(); |
| 0 | 163 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 164 | | request.Content = content; |
| 0 | 165 | | return message; |
| | 166 | | } |
| | 167 | |
|
| | 168 | | /// <summary> Update an dedicated host . </summary> |
| | 169 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 170 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 171 | | /// <param name="hostName"> The name of the dedicated host . </param> |
| | 172 | | /// <param name="parameters"> Parameters supplied to the Update Dedicated Host operation. </param> |
| | 173 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 174 | | public async Task<Response> UpdateAsync(string resourceGroupName, string hostGroupName, string hostName, Dedicat |
| | 175 | | { |
| 0 | 176 | | if (resourceGroupName == null) |
| | 177 | | { |
| 0 | 178 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 179 | | } |
| 0 | 180 | | if (hostGroupName == null) |
| | 181 | | { |
| 0 | 182 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 183 | | } |
| 0 | 184 | | if (hostName == null) |
| | 185 | | { |
| 0 | 186 | | throw new ArgumentNullException(nameof(hostName)); |
| | 187 | | } |
| 0 | 188 | | if (parameters == null) |
| | 189 | | { |
| 0 | 190 | | throw new ArgumentNullException(nameof(parameters)); |
| | 191 | | } |
| | 192 | |
|
| 0 | 193 | | using var message = CreateUpdateRequest(resourceGroupName, hostGroupName, hostName, parameters); |
| 0 | 194 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 195 | | switch (message.Response.Status) |
| | 196 | | { |
| | 197 | | case 200: |
| 0 | 198 | | return message.Response; |
| | 199 | | default: |
| 0 | 200 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 201 | | } |
| 0 | 202 | | } |
| | 203 | |
|
| | 204 | | /// <summary> Update an dedicated host . </summary> |
| | 205 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 206 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 207 | | /// <param name="hostName"> The name of the dedicated host . </param> |
| | 208 | | /// <param name="parameters"> Parameters supplied to the Update Dedicated Host operation. </param> |
| | 209 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 210 | | public Response Update(string resourceGroupName, string hostGroupName, string hostName, DedicatedHostUpdate para |
| | 211 | | { |
| 0 | 212 | | if (resourceGroupName == null) |
| | 213 | | { |
| 0 | 214 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 215 | | } |
| 0 | 216 | | if (hostGroupName == null) |
| | 217 | | { |
| 0 | 218 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 219 | | } |
| 0 | 220 | | if (hostName == null) |
| | 221 | | { |
| 0 | 222 | | throw new ArgumentNullException(nameof(hostName)); |
| | 223 | | } |
| 0 | 224 | | if (parameters == null) |
| | 225 | | { |
| 0 | 226 | | throw new ArgumentNullException(nameof(parameters)); |
| | 227 | | } |
| | 228 | |
|
| 0 | 229 | | using var message = CreateUpdateRequest(resourceGroupName, hostGroupName, hostName, parameters); |
| 0 | 230 | | _pipeline.Send(message, cancellationToken); |
| 0 | 231 | | switch (message.Response.Status) |
| | 232 | | { |
| | 233 | | case 200: |
| 0 | 234 | | return message.Response; |
| | 235 | | default: |
| 0 | 236 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 237 | | } |
| 0 | 238 | | } |
| | 239 | |
|
| | 240 | | internal HttpMessage CreateDeleteRequest(string resourceGroupName, string hostGroupName, string hostName) |
| | 241 | | { |
| 8 | 242 | | var message = _pipeline.CreateMessage(); |
| 8 | 243 | | var request = message.Request; |
| 8 | 244 | | request.Method = RequestMethod.Delete; |
| 8 | 245 | | var uri = new RawRequestUriBuilder(); |
| 8 | 246 | | uri.Reset(endpoint); |
| 8 | 247 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 248 | | uri.AppendPath(subscriptionId, true); |
| 8 | 249 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 250 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 251 | | uri.AppendPath("/providers/Microsoft.Compute/hostGroups/", false); |
| 8 | 252 | | uri.AppendPath(hostGroupName, true); |
| 8 | 253 | | uri.AppendPath("/hosts/", false); |
| 8 | 254 | | uri.AppendPath(hostName, true); |
| 8 | 255 | | uri.AppendQuery("api-version", "2019-12-01", true); |
| 8 | 256 | | request.Uri = uri; |
| 8 | 257 | | return message; |
| | 258 | | } |
| | 259 | |
|
| | 260 | | /// <summary> Delete a dedicated host. </summary> |
| | 261 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 262 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 263 | | /// <param name="hostName"> The name of the dedicated host. </param> |
| | 264 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 265 | | public async Task<Response> DeleteAsync(string resourceGroupName, string hostGroupName, string hostName, Cancell |
| | 266 | | { |
| 2 | 267 | | if (resourceGroupName == null) |
| | 268 | | { |
| 0 | 269 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 270 | | } |
| 2 | 271 | | if (hostGroupName == null) |
| | 272 | | { |
| 0 | 273 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 274 | | } |
| 2 | 275 | | if (hostName == null) |
| | 276 | | { |
| 0 | 277 | | throw new ArgumentNullException(nameof(hostName)); |
| | 278 | | } |
| | 279 | |
|
| 2 | 280 | | using var message = CreateDeleteRequest(resourceGroupName, hostGroupName, hostName); |
| 2 | 281 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 282 | | switch (message.Response.Status) |
| | 283 | | { |
| | 284 | | case 200: |
| | 285 | | case 202: |
| | 286 | | case 204: |
| 2 | 287 | | return message.Response; |
| | 288 | | default: |
| 0 | 289 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 290 | | } |
| 2 | 291 | | } |
| | 292 | |
|
| | 293 | | /// <summary> Delete a dedicated host. </summary> |
| | 294 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 295 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 296 | | /// <param name="hostName"> The name of the dedicated host. </param> |
| | 297 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 298 | | public Response Delete(string resourceGroupName, string hostGroupName, string hostName, CancellationToken cancel |
| | 299 | | { |
| 2 | 300 | | if (resourceGroupName == null) |
| | 301 | | { |
| 0 | 302 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 303 | | } |
| 2 | 304 | | if (hostGroupName == null) |
| | 305 | | { |
| 0 | 306 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 307 | | } |
| 2 | 308 | | if (hostName == null) |
| | 309 | | { |
| 0 | 310 | | throw new ArgumentNullException(nameof(hostName)); |
| | 311 | | } |
| | 312 | |
|
| 2 | 313 | | using var message = CreateDeleteRequest(resourceGroupName, hostGroupName, hostName); |
| 2 | 314 | | _pipeline.Send(message, cancellationToken); |
| 2 | 315 | | switch (message.Response.Status) |
| | 316 | | { |
| | 317 | | case 200: |
| | 318 | | case 202: |
| | 319 | | case 204: |
| 2 | 320 | | return message.Response; |
| | 321 | | default: |
| 0 | 322 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 323 | | } |
| 2 | 324 | | } |
| | 325 | |
|
| | 326 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string hostGroupName, string hostName) |
| | 327 | | { |
| 4 | 328 | | var message = _pipeline.CreateMessage(); |
| 4 | 329 | | var request = message.Request; |
| 4 | 330 | | request.Method = RequestMethod.Get; |
| 4 | 331 | | var uri = new RawRequestUriBuilder(); |
| 4 | 332 | | uri.Reset(endpoint); |
| 4 | 333 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 334 | | uri.AppendPath(subscriptionId, true); |
| 4 | 335 | | uri.AppendPath("/resourceGroups/", false); |
| 4 | 336 | | uri.AppendPath(resourceGroupName, true); |
| 4 | 337 | | uri.AppendPath("/providers/Microsoft.Compute/hostGroups/", false); |
| 4 | 338 | | uri.AppendPath(hostGroupName, true); |
| 4 | 339 | | uri.AppendPath("/hosts/", false); |
| 4 | 340 | | uri.AppendPath(hostName, true); |
| 4 | 341 | | uri.AppendQuery("$expand", "instanceView", true); |
| 4 | 342 | | uri.AppendQuery("api-version", "2019-12-01", true); |
| 4 | 343 | | request.Uri = uri; |
| 4 | 344 | | return message; |
| | 345 | | } |
| | 346 | |
|
| | 347 | | /// <summary> Retrieves information about a dedicated host. </summary> |
| | 348 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 349 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 350 | | /// <param name="hostName"> The name of the dedicated host. </param> |
| | 351 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 352 | | public async Task<Response<DedicatedHost>> GetAsync(string resourceGroupName, string hostGroupName, string hostN |
| | 353 | | { |
| 2 | 354 | | if (resourceGroupName == null) |
| | 355 | | { |
| 0 | 356 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 357 | | } |
| 2 | 358 | | if (hostGroupName == null) |
| | 359 | | { |
| 0 | 360 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 361 | | } |
| 2 | 362 | | if (hostName == null) |
| | 363 | | { |
| 0 | 364 | | throw new ArgumentNullException(nameof(hostName)); |
| | 365 | | } |
| | 366 | |
|
| 2 | 367 | | using var message = CreateGetRequest(resourceGroupName, hostGroupName, hostName); |
| 2 | 368 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 369 | | switch (message.Response.Status) |
| | 370 | | { |
| | 371 | | case 200: |
| | 372 | | { |
| 2 | 373 | | DedicatedHost value = default; |
| 2 | 374 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 375 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 376 | | { |
| 0 | 377 | | value = null; |
| | 378 | | } |
| | 379 | | else |
| | 380 | | { |
| 2 | 381 | | value = DedicatedHost.DeserializeDedicatedHost(document.RootElement); |
| | 382 | | } |
| 2 | 383 | | return Response.FromValue(value, message.Response); |
| | 384 | | } |
| | 385 | | default: |
| 0 | 386 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 387 | | } |
| 2 | 388 | | } |
| | 389 | |
|
| | 390 | | /// <summary> Retrieves information about a dedicated host. </summary> |
| | 391 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 392 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 393 | | /// <param name="hostName"> The name of the dedicated host. </param> |
| | 394 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 395 | | public Response<DedicatedHost> Get(string resourceGroupName, string hostGroupName, string hostName, Cancellation |
| | 396 | | { |
| 2 | 397 | | if (resourceGroupName == null) |
| | 398 | | { |
| 0 | 399 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 400 | | } |
| 2 | 401 | | if (hostGroupName == null) |
| | 402 | | { |
| 0 | 403 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 404 | | } |
| 2 | 405 | | if (hostName == null) |
| | 406 | | { |
| 0 | 407 | | throw new ArgumentNullException(nameof(hostName)); |
| | 408 | | } |
| | 409 | |
|
| 2 | 410 | | using var message = CreateGetRequest(resourceGroupName, hostGroupName, hostName); |
| 2 | 411 | | _pipeline.Send(message, cancellationToken); |
| 2 | 412 | | switch (message.Response.Status) |
| | 413 | | { |
| | 414 | | case 200: |
| | 415 | | { |
| 2 | 416 | | DedicatedHost value = default; |
| 2 | 417 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 418 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 419 | | { |
| 0 | 420 | | value = null; |
| | 421 | | } |
| | 422 | | else |
| | 423 | | { |
| 2 | 424 | | value = DedicatedHost.DeserializeDedicatedHost(document.RootElement); |
| | 425 | | } |
| 2 | 426 | | return Response.FromValue(value, message.Response); |
| | 427 | | } |
| | 428 | | default: |
| 0 | 429 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 430 | | } |
| 2 | 431 | | } |
| | 432 | |
|
| | 433 | | internal HttpMessage CreateListByHostGroupRequest(string resourceGroupName, string hostGroupName) |
| | 434 | | { |
| 4 | 435 | | var message = _pipeline.CreateMessage(); |
| 4 | 436 | | var request = message.Request; |
| 4 | 437 | | request.Method = RequestMethod.Get; |
| 4 | 438 | | var uri = new RawRequestUriBuilder(); |
| 4 | 439 | | uri.Reset(endpoint); |
| 4 | 440 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 441 | | uri.AppendPath(subscriptionId, true); |
| 4 | 442 | | uri.AppendPath("/resourceGroups/", false); |
| 4 | 443 | | uri.AppendPath(resourceGroupName, true); |
| 4 | 444 | | uri.AppendPath("/providers/Microsoft.Compute/hostGroups/", false); |
| 4 | 445 | | uri.AppendPath(hostGroupName, true); |
| 4 | 446 | | uri.AppendPath("/hosts", false); |
| 4 | 447 | | uri.AppendQuery("api-version", "2019-12-01", true); |
| 4 | 448 | | request.Uri = uri; |
| 4 | 449 | | return message; |
| | 450 | | } |
| | 451 | |
|
| | 452 | | /// <summary> Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property |
| | 453 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 454 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 455 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 456 | | public async Task<Response<DedicatedHostListResult>> ListByHostGroupAsync(string resourceGroupName, string hostG |
| | 457 | | { |
| 2 | 458 | | if (resourceGroupName == null) |
| | 459 | | { |
| 0 | 460 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 461 | | } |
| 2 | 462 | | if (hostGroupName == null) |
| | 463 | | { |
| 0 | 464 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 465 | | } |
| | 466 | |
|
| 2 | 467 | | using var message = CreateListByHostGroupRequest(resourceGroupName, hostGroupName); |
| 2 | 468 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 469 | | switch (message.Response.Status) |
| | 470 | | { |
| | 471 | | case 200: |
| | 472 | | { |
| 2 | 473 | | DedicatedHostListResult value = default; |
| 2 | 474 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 475 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 476 | | { |
| 0 | 477 | | value = null; |
| | 478 | | } |
| | 479 | | else |
| | 480 | | { |
| 2 | 481 | | value = DedicatedHostListResult.DeserializeDedicatedHostListResult(document.RootElement); |
| | 482 | | } |
| 2 | 483 | | return Response.FromValue(value, message.Response); |
| | 484 | | } |
| | 485 | | default: |
| 0 | 486 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 487 | | } |
| 2 | 488 | | } |
| | 489 | |
|
| | 490 | | /// <summary> Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property |
| | 491 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 492 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 493 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 494 | | public Response<DedicatedHostListResult> ListByHostGroup(string resourceGroupName, string hostGroupName, Cancell |
| | 495 | | { |
| 2 | 496 | | if (resourceGroupName == null) |
| | 497 | | { |
| 0 | 498 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 499 | | } |
| 2 | 500 | | if (hostGroupName == null) |
| | 501 | | { |
| 0 | 502 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 503 | | } |
| | 504 | |
|
| 2 | 505 | | using var message = CreateListByHostGroupRequest(resourceGroupName, hostGroupName); |
| 2 | 506 | | _pipeline.Send(message, cancellationToken); |
| 2 | 507 | | switch (message.Response.Status) |
| | 508 | | { |
| | 509 | | case 200: |
| | 510 | | { |
| 2 | 511 | | DedicatedHostListResult value = default; |
| 2 | 512 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 513 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 514 | | { |
| 0 | 515 | | value = null; |
| | 516 | | } |
| | 517 | | else |
| | 518 | | { |
| 2 | 519 | | value = DedicatedHostListResult.DeserializeDedicatedHostListResult(document.RootElement); |
| | 520 | | } |
| 2 | 521 | | return Response.FromValue(value, message.Response); |
| | 522 | | } |
| | 523 | | default: |
| 0 | 524 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 525 | | } |
| 2 | 526 | | } |
| | 527 | |
|
| | 528 | | internal HttpMessage CreateListByHostGroupNextPageRequest(string nextLink, string resourceGroupName, string host |
| | 529 | | { |
| 0 | 530 | | var message = _pipeline.CreateMessage(); |
| 0 | 531 | | var request = message.Request; |
| 0 | 532 | | request.Method = RequestMethod.Get; |
| 0 | 533 | | var uri = new RawRequestUriBuilder(); |
| 0 | 534 | | uri.Reset(endpoint); |
| 0 | 535 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 536 | | request.Uri = uri; |
| 0 | 537 | | return message; |
| | 538 | | } |
| | 539 | |
|
| | 540 | | /// <summary> Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property |
| | 541 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 542 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 543 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 544 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 545 | | public async Task<Response<DedicatedHostListResult>> ListByHostGroupNextPageAsync(string nextLink, string resour |
| | 546 | | { |
| 0 | 547 | | if (nextLink == null) |
| | 548 | | { |
| 0 | 549 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 550 | | } |
| 0 | 551 | | if (resourceGroupName == null) |
| | 552 | | { |
| 0 | 553 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 554 | | } |
| 0 | 555 | | if (hostGroupName == null) |
| | 556 | | { |
| 0 | 557 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 558 | | } |
| | 559 | |
|
| 0 | 560 | | using var message = CreateListByHostGroupNextPageRequest(nextLink, resourceGroupName, hostGroupName); |
| 0 | 561 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 562 | | switch (message.Response.Status) |
| | 563 | | { |
| | 564 | | case 200: |
| | 565 | | { |
| 0 | 566 | | DedicatedHostListResult value = default; |
| 0 | 567 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 568 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 569 | | { |
| 0 | 570 | | value = null; |
| | 571 | | } |
| | 572 | | else |
| | 573 | | { |
| 0 | 574 | | value = DedicatedHostListResult.DeserializeDedicatedHostListResult(document.RootElement); |
| | 575 | | } |
| 0 | 576 | | return Response.FromValue(value, message.Response); |
| | 577 | | } |
| | 578 | | default: |
| 0 | 579 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 580 | | } |
| 0 | 581 | | } |
| | 582 | |
|
| | 583 | | /// <summary> Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property |
| | 584 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 585 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 586 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 587 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 588 | | public Response<DedicatedHostListResult> ListByHostGroupNextPage(string nextLink, string resourceGroupName, stri |
| | 589 | | { |
| 0 | 590 | | if (nextLink == null) |
| | 591 | | { |
| 0 | 592 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 593 | | } |
| 0 | 594 | | if (resourceGroupName == null) |
| | 595 | | { |
| 0 | 596 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 597 | | } |
| 0 | 598 | | if (hostGroupName == null) |
| | 599 | | { |
| 0 | 600 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 601 | | } |
| | 602 | |
|
| 0 | 603 | | using var message = CreateListByHostGroupNextPageRequest(nextLink, resourceGroupName, hostGroupName); |
| 0 | 604 | | _pipeline.Send(message, cancellationToken); |
| 0 | 605 | | switch (message.Response.Status) |
| | 606 | | { |
| | 607 | | case 200: |
| | 608 | | { |
| 0 | 609 | | DedicatedHostListResult value = default; |
| 0 | 610 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 611 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 612 | | { |
| 0 | 613 | | value = null; |
| | 614 | | } |
| | 615 | | else |
| | 616 | | { |
| 0 | 617 | | value = DedicatedHostListResult.DeserializeDedicatedHostListResult(document.RootElement); |
| | 618 | | } |
| 0 | 619 | | return Response.FromValue(value, message.Response); |
| | 620 | | } |
| | 621 | | default: |
| 0 | 622 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 623 | | } |
| 0 | 624 | | } |
| | 625 | | } |
| | 626 | | } |