| | 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.Threading; |
| | 10 | | using System.Threading.Tasks; |
| | 11 | | using Azure; |
| | 12 | | using Azure.Core; |
| | 13 | | using Azure.Core.Pipeline; |
| | 14 | | using Azure.ResourceManager.Compute.Models; |
| | 15 | |
|
| | 16 | | namespace Azure.ResourceManager.Compute |
| | 17 | | { |
| | 18 | | /// <summary> The DedicatedHosts service client. </summary> |
| | 19 | | public partial class DedicatedHostsOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 24 | 23 | | internal DedicatedHostsRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of DedicatedHostsOperations for mocking. </summary> |
| 396 | 25 | | protected DedicatedHostsOperations() |
| | 26 | | { |
| 396 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of DedicatedHostsOperations. </summary> |
| | 29 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 30 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 31 | | /// <param name="subscriptionId"> Subscription credentials which uniquely identify Microsoft Azure subscription. |
| | 32 | | /// <param name="endpoint"> server parameter. </param> |
| 396 | 33 | | internal DedicatedHostsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptio |
| | 34 | | { |
| 396 | 35 | | RestClient = new DedicatedHostsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 396 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 396 | 37 | | _pipeline = pipeline; |
| 396 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Retrieves information about a dedicated host. </summary> |
| | 41 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 42 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 43 | | /// <param name="hostName"> The name of the dedicated host. </param> |
| | 44 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 45 | | public virtual async Task<Response<DedicatedHost>> GetAsync(string resourceGroupName, string hostGroupName, stri |
| | 46 | | { |
| 2 | 47 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostsOperations.Get"); |
| 2 | 48 | | scope.Start(); |
| | 49 | | try |
| | 50 | | { |
| 2 | 51 | | return await RestClient.GetAsync(resourceGroupName, hostGroupName, hostName, cancellationToken).Configur |
| | 52 | | } |
| 0 | 53 | | catch (Exception e) |
| | 54 | | { |
| 0 | 55 | | scope.Failed(e); |
| 0 | 56 | | throw; |
| | 57 | | } |
| 2 | 58 | | } |
| | 59 | |
|
| | 60 | | /// <summary> Retrieves information about a dedicated host. </summary> |
| | 61 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 62 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 63 | | /// <param name="hostName"> The name of the dedicated host. </param> |
| | 64 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 65 | | public virtual Response<DedicatedHost> Get(string resourceGroupName, string hostGroupName, string hostName, Canc |
| | 66 | | { |
| 2 | 67 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostsOperations.Get"); |
| 2 | 68 | | scope.Start(); |
| | 69 | | try |
| | 70 | | { |
| 2 | 71 | | return RestClient.Get(resourceGroupName, hostGroupName, hostName, cancellationToken); |
| | 72 | | } |
| 0 | 73 | | catch (Exception e) |
| | 74 | | { |
| 0 | 75 | | scope.Failed(e); |
| 0 | 76 | | throw; |
| | 77 | | } |
| 2 | 78 | | } |
| | 79 | |
|
| | 80 | | /// <summary> Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property |
| | 81 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 82 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 83 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 84 | | public virtual AsyncPageable<DedicatedHost> ListByHostGroupAsync(string resourceGroupName, string hostGroupName, |
| | 85 | | { |
| 2 | 86 | | if (resourceGroupName == null) |
| | 87 | | { |
| 0 | 88 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 89 | | } |
| 2 | 90 | | if (hostGroupName == null) |
| | 91 | | { |
| 0 | 92 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 93 | | } |
| | 94 | |
|
| | 95 | | async Task<Page<DedicatedHost>> FirstPageFunc(int? pageSizeHint) |
| | 96 | | { |
| 2 | 97 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostsOperations.ListByHostGroup"); |
| 2 | 98 | | scope.Start(); |
| | 99 | | try |
| | 100 | | { |
| 2 | 101 | | var response = await RestClient.ListByHostGroupAsync(resourceGroupName, hostGroupName, cancellationT |
| 2 | 102 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 103 | | } |
| 0 | 104 | | catch (Exception e) |
| | 105 | | { |
| 0 | 106 | | scope.Failed(e); |
| 0 | 107 | | throw; |
| | 108 | | } |
| 2 | 109 | | } |
| | 110 | | async Task<Page<DedicatedHost>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 111 | | { |
| 0 | 112 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostsOperations.ListByHostGroup"); |
| 0 | 113 | | scope.Start(); |
| | 114 | | try |
| | 115 | | { |
| 0 | 116 | | var response = await RestClient.ListByHostGroupNextPageAsync(nextLink, resourceGroupName, hostGroupN |
| 0 | 117 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 118 | | } |
| 0 | 119 | | catch (Exception e) |
| | 120 | | { |
| 0 | 121 | | scope.Failed(e); |
| 0 | 122 | | throw; |
| | 123 | | } |
| 0 | 124 | | } |
| 2 | 125 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 126 | | } |
| | 127 | |
|
| | 128 | | /// <summary> Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink property |
| | 129 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 130 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 131 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 132 | | public virtual Pageable<DedicatedHost> ListByHostGroup(string resourceGroupName, string hostGroupName, Cancellat |
| | 133 | | { |
| 2 | 134 | | if (resourceGroupName == null) |
| | 135 | | { |
| 0 | 136 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 137 | | } |
| 2 | 138 | | if (hostGroupName == null) |
| | 139 | | { |
| 0 | 140 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 141 | | } |
| | 142 | |
|
| | 143 | | Page<DedicatedHost> FirstPageFunc(int? pageSizeHint) |
| | 144 | | { |
| 2 | 145 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostsOperations.ListByHostGroup"); |
| 2 | 146 | | scope.Start(); |
| | 147 | | try |
| | 148 | | { |
| 2 | 149 | | var response = RestClient.ListByHostGroup(resourceGroupName, hostGroupName, cancellationToken); |
| 2 | 150 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 151 | | } |
| 0 | 152 | | catch (Exception e) |
| | 153 | | { |
| 0 | 154 | | scope.Failed(e); |
| 0 | 155 | | throw; |
| | 156 | | } |
| 2 | 157 | | } |
| | 158 | | Page<DedicatedHost> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 159 | | { |
| 0 | 160 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostsOperations.ListByHostGroup"); |
| 0 | 161 | | scope.Start(); |
| | 162 | | try |
| | 163 | | { |
| 0 | 164 | | var response = RestClient.ListByHostGroupNextPage(nextLink, resourceGroupName, hostGroupName, cancel |
| 0 | 165 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 166 | | } |
| 0 | 167 | | catch (Exception e) |
| | 168 | | { |
| 0 | 169 | | scope.Failed(e); |
| 0 | 170 | | throw; |
| | 171 | | } |
| 0 | 172 | | } |
| 2 | 173 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 174 | | } |
| | 175 | |
|
| | 176 | | /// <summary> Create or update a dedicated host . </summary> |
| | 177 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 178 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 179 | | /// <param name="hostName"> The name of the dedicated host . </param> |
| | 180 | | /// <param name="parameters"> Parameters supplied to the Create Dedicated Host. </param> |
| | 181 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 182 | | public virtual async Task<DedicatedHostsCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroupNa |
| | 183 | | { |
| 2 | 184 | | if (resourceGroupName == null) |
| | 185 | | { |
| 0 | 186 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 187 | | } |
| 2 | 188 | | if (hostGroupName == null) |
| | 189 | | { |
| 0 | 190 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 191 | | } |
| 2 | 192 | | if (hostName == null) |
| | 193 | | { |
| 0 | 194 | | throw new ArgumentNullException(nameof(hostName)); |
| | 195 | | } |
| 2 | 196 | | if (parameters == null) |
| | 197 | | { |
| 0 | 198 | | throw new ArgumentNullException(nameof(parameters)); |
| | 199 | | } |
| | 200 | |
|
| 2 | 201 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostsOperations.StartCreateOrUpdate"); |
| 2 | 202 | | scope.Start(); |
| | 203 | | try |
| | 204 | | { |
| 2 | 205 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, hostGroupName, hostName, |
| 2 | 206 | | return new DedicatedHostsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateO |
| | 207 | | } |
| 0 | 208 | | catch (Exception e) |
| | 209 | | { |
| 0 | 210 | | scope.Failed(e); |
| 0 | 211 | | throw; |
| | 212 | | } |
| 2 | 213 | | } |
| | 214 | |
|
| | 215 | | /// <summary> Create or update a dedicated host . </summary> |
| | 216 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 217 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 218 | | /// <param name="hostName"> The name of the dedicated host . </param> |
| | 219 | | /// <param name="parameters"> Parameters supplied to the Create Dedicated Host. </param> |
| | 220 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 221 | | public virtual DedicatedHostsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string hostGr |
| | 222 | | { |
| 2 | 223 | | if (resourceGroupName == null) |
| | 224 | | { |
| 0 | 225 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 226 | | } |
| 2 | 227 | | if (hostGroupName == null) |
| | 228 | | { |
| 0 | 229 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 230 | | } |
| 2 | 231 | | if (hostName == null) |
| | 232 | | { |
| 0 | 233 | | throw new ArgumentNullException(nameof(hostName)); |
| | 234 | | } |
| 2 | 235 | | if (parameters == null) |
| | 236 | | { |
| 0 | 237 | | throw new ArgumentNullException(nameof(parameters)); |
| | 238 | | } |
| | 239 | |
|
| 2 | 240 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostsOperations.StartCreateOrUpdate"); |
| 2 | 241 | | scope.Start(); |
| | 242 | | try |
| | 243 | | { |
| 2 | 244 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, hostGroupName, hostName, parameters, |
| 2 | 245 | | return new DedicatedHostsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateO |
| | 246 | | } |
| 0 | 247 | | catch (Exception e) |
| | 248 | | { |
| 0 | 249 | | scope.Failed(e); |
| 0 | 250 | | throw; |
| | 251 | | } |
| 2 | 252 | | } |
| | 253 | |
|
| | 254 | | /// <summary> Update an dedicated host . </summary> |
| | 255 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 256 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 257 | | /// <param name="hostName"> The name of the dedicated host . </param> |
| | 258 | | /// <param name="parameters"> Parameters supplied to the Update Dedicated Host operation. </param> |
| | 259 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 260 | | public virtual async Task<DedicatedHostsUpdateOperation> StartUpdateAsync(string resourceGroupName, string hostG |
| | 261 | | { |
| 0 | 262 | | if (resourceGroupName == null) |
| | 263 | | { |
| 0 | 264 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 265 | | } |
| 0 | 266 | | if (hostGroupName == null) |
| | 267 | | { |
| 0 | 268 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 269 | | } |
| 0 | 270 | | if (hostName == null) |
| | 271 | | { |
| 0 | 272 | | throw new ArgumentNullException(nameof(hostName)); |
| | 273 | | } |
| 0 | 274 | | if (parameters == null) |
| | 275 | | { |
| 0 | 276 | | throw new ArgumentNullException(nameof(parameters)); |
| | 277 | | } |
| | 278 | |
|
| 0 | 279 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostsOperations.StartUpdate"); |
| 0 | 280 | | scope.Start(); |
| | 281 | | try |
| | 282 | | { |
| 0 | 283 | | var originalResponse = await RestClient.UpdateAsync(resourceGroupName, hostGroupName, hostName, paramete |
| 0 | 284 | | return new DedicatedHostsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(r |
| | 285 | | } |
| 0 | 286 | | catch (Exception e) |
| | 287 | | { |
| 0 | 288 | | scope.Failed(e); |
| 0 | 289 | | throw; |
| | 290 | | } |
| 0 | 291 | | } |
| | 292 | |
|
| | 293 | | /// <summary> Update an 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="parameters"> Parameters supplied to the Update Dedicated Host operation. </param> |
| | 298 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 299 | | public virtual DedicatedHostsUpdateOperation StartUpdate(string resourceGroupName, string hostGroupName, string |
| | 300 | | { |
| 0 | 301 | | if (resourceGroupName == null) |
| | 302 | | { |
| 0 | 303 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 304 | | } |
| 0 | 305 | | if (hostGroupName == null) |
| | 306 | | { |
| 0 | 307 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 308 | | } |
| 0 | 309 | | if (hostName == null) |
| | 310 | | { |
| 0 | 311 | | throw new ArgumentNullException(nameof(hostName)); |
| | 312 | | } |
| 0 | 313 | | if (parameters == null) |
| | 314 | | { |
| 0 | 315 | | throw new ArgumentNullException(nameof(parameters)); |
| | 316 | | } |
| | 317 | |
|
| 0 | 318 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostsOperations.StartUpdate"); |
| 0 | 319 | | scope.Start(); |
| | 320 | | try |
| | 321 | | { |
| 0 | 322 | | var originalResponse = RestClient.Update(resourceGroupName, hostGroupName, hostName, parameters, cancell |
| 0 | 323 | | return new DedicatedHostsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(r |
| | 324 | | } |
| 0 | 325 | | catch (Exception e) |
| | 326 | | { |
| 0 | 327 | | scope.Failed(e); |
| 0 | 328 | | throw; |
| | 329 | | } |
| 0 | 330 | | } |
| | 331 | |
|
| | 332 | | /// <summary> Delete a dedicated host. </summary> |
| | 333 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 334 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 335 | | /// <param name="hostName"> The name of the dedicated host. </param> |
| | 336 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 337 | | public virtual async Task<DedicatedHostsDeleteOperation> StartDeleteAsync(string resourceGroupName, string hostG |
| | 338 | | { |
| 2 | 339 | | if (resourceGroupName == null) |
| | 340 | | { |
| 0 | 341 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 342 | | } |
| 2 | 343 | | if (hostGroupName == null) |
| | 344 | | { |
| 0 | 345 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 346 | | } |
| 2 | 347 | | if (hostName == null) |
| | 348 | | { |
| 0 | 349 | | throw new ArgumentNullException(nameof(hostName)); |
| | 350 | | } |
| | 351 | |
|
| 2 | 352 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostsOperations.StartDelete"); |
| 2 | 353 | | scope.Start(); |
| | 354 | | try |
| | 355 | | { |
| 2 | 356 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, hostGroupName, hostName, cancella |
| 2 | 357 | | return new DedicatedHostsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(r |
| | 358 | | } |
| 0 | 359 | | catch (Exception e) |
| | 360 | | { |
| 0 | 361 | | scope.Failed(e); |
| 0 | 362 | | throw; |
| | 363 | | } |
| 2 | 364 | | } |
| | 365 | |
|
| | 366 | | /// <summary> Delete a dedicated host. </summary> |
| | 367 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 368 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 369 | | /// <param name="hostName"> The name of the dedicated host. </param> |
| | 370 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 371 | | public virtual DedicatedHostsDeleteOperation StartDelete(string resourceGroupName, string hostGroupName, string |
| | 372 | | { |
| 2 | 373 | | if (resourceGroupName == null) |
| | 374 | | { |
| 0 | 375 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 376 | | } |
| 2 | 377 | | if (hostGroupName == null) |
| | 378 | | { |
| 0 | 379 | | throw new ArgumentNullException(nameof(hostGroupName)); |
| | 380 | | } |
| 2 | 381 | | if (hostName == null) |
| | 382 | | { |
| 0 | 383 | | throw new ArgumentNullException(nameof(hostName)); |
| | 384 | | } |
| | 385 | |
|
| 2 | 386 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostsOperations.StartDelete"); |
| 2 | 387 | | scope.Start(); |
| | 388 | | try |
| | 389 | | { |
| 2 | 390 | | var originalResponse = RestClient.Delete(resourceGroupName, hostGroupName, hostName, cancellationToken); |
| 2 | 391 | | return new DedicatedHostsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(r |
| | 392 | | } |
| 0 | 393 | | catch (Exception e) |
| | 394 | | { |
| 0 | 395 | | scope.Failed(e); |
| 0 | 396 | | throw; |
| | 397 | | } |
| 2 | 398 | | } |
| | 399 | | } |
| | 400 | | } |