| | 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 DedicatedHostGroups service client. </summary> |
| | 19 | | public partial class DedicatedHostGroupsOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 28 | 23 | | internal DedicatedHostGroupsRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of DedicatedHostGroupsOperations for mocking. </summary> |
| 396 | 25 | | protected DedicatedHostGroupsOperations() |
| | 26 | | { |
| 396 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of DedicatedHostGroupsOperations. </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 DedicatedHostGroupsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscr |
| | 34 | | { |
| 396 | 35 | | RestClient = new DedicatedHostGroupsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 396 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 396 | 37 | | _pipeline = pipeline; |
| 396 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups p |
| | 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="parameters"> Parameters supplied to the Create Dedicated Host Group. </param> |
| | 44 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 45 | | public virtual async Task<Response<DedicatedHostGroup>> CreateOrUpdateAsync(string resourceGroupName, string hos |
| | 46 | | { |
| 2 | 47 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostGroupsOperations.CreateOrUpdate"); |
| 2 | 48 | | scope.Start(); |
| | 49 | | try |
| | 50 | | { |
| 2 | 51 | | return await RestClient.CreateOrUpdateAsync(resourceGroupName, hostGroupName, parameters, cancellationTo |
| | 52 | | } |
| 0 | 53 | | catch (Exception e) |
| | 54 | | { |
| 0 | 55 | | scope.Failed(e); |
| 0 | 56 | | throw; |
| | 57 | | } |
| 2 | 58 | | } |
| | 59 | |
|
| | 60 | | /// <summary> Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups p |
| | 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="parameters"> Parameters supplied to the Create Dedicated Host Group. </param> |
| | 64 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 65 | | public virtual Response<DedicatedHostGroup> CreateOrUpdate(string resourceGroupName, string hostGroupName, Dedic |
| | 66 | | { |
| 2 | 67 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostGroupsOperations.CreateOrUpdate"); |
| 2 | 68 | | scope.Start(); |
| | 69 | | try |
| | 70 | | { |
| 2 | 71 | | return RestClient.CreateOrUpdate(resourceGroupName, hostGroupName, parameters, cancellationToken); |
| | 72 | | } |
| 0 | 73 | | catch (Exception e) |
| | 74 | | { |
| 0 | 75 | | scope.Failed(e); |
| 0 | 76 | | throw; |
| | 77 | | } |
| 2 | 78 | | } |
| | 79 | |
|
| | 80 | | /// <summary> Update an dedicated host group. </summary> |
| | 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="parameters"> Parameters supplied to the Update Dedicated Host Group operation. </param> |
| | 84 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 85 | | public virtual async Task<Response<DedicatedHostGroup>> UpdateAsync(string resourceGroupName, string hostGroupNa |
| | 86 | | { |
| 2 | 87 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostGroupsOperations.Update"); |
| 2 | 88 | | scope.Start(); |
| | 89 | | try |
| | 90 | | { |
| 2 | 91 | | return await RestClient.UpdateAsync(resourceGroupName, hostGroupName, parameters, cancellationToken).Con |
| | 92 | | } |
| 0 | 93 | | catch (Exception e) |
| | 94 | | { |
| 0 | 95 | | scope.Failed(e); |
| 0 | 96 | | throw; |
| | 97 | | } |
| 2 | 98 | | } |
| | 99 | |
|
| | 100 | | /// <summary> Update an dedicated host group. </summary> |
| | 101 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 102 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 103 | | /// <param name="parameters"> Parameters supplied to the Update Dedicated Host Group operation. </param> |
| | 104 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 105 | | public virtual Response<DedicatedHostGroup> Update(string resourceGroupName, string hostGroupName, DedicatedHost |
| | 106 | | { |
| 2 | 107 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostGroupsOperations.Update"); |
| 2 | 108 | | scope.Start(); |
| | 109 | | try |
| | 110 | | { |
| 2 | 111 | | return RestClient.Update(resourceGroupName, hostGroupName, parameters, cancellationToken); |
| | 112 | | } |
| 0 | 113 | | catch (Exception e) |
| | 114 | | { |
| 0 | 115 | | scope.Failed(e); |
| 0 | 116 | | throw; |
| | 117 | | } |
| 2 | 118 | | } |
| | 119 | |
|
| | 120 | | /// <summary> Delete a dedicated host group. </summary> |
| | 121 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 122 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 123 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 124 | | public virtual async Task<Response> DeleteAsync(string resourceGroupName, string hostGroupName, CancellationToke |
| | 125 | | { |
| 2 | 126 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostGroupsOperations.Delete"); |
| 2 | 127 | | scope.Start(); |
| | 128 | | try |
| | 129 | | { |
| 2 | 130 | | return await RestClient.DeleteAsync(resourceGroupName, hostGroupName, cancellationToken).ConfigureAwait( |
| | 131 | | } |
| 0 | 132 | | catch (Exception e) |
| | 133 | | { |
| 0 | 134 | | scope.Failed(e); |
| 0 | 135 | | throw; |
| | 136 | | } |
| 2 | 137 | | } |
| | 138 | |
|
| | 139 | | /// <summary> Delete a dedicated host group. </summary> |
| | 140 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 141 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 142 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 143 | | public virtual Response Delete(string resourceGroupName, string hostGroupName, CancellationToken cancellationTok |
| | 144 | | { |
| 2 | 145 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostGroupsOperations.Delete"); |
| 2 | 146 | | scope.Start(); |
| | 147 | | try |
| | 148 | | { |
| 2 | 149 | | return RestClient.Delete(resourceGroupName, hostGroupName, cancellationToken); |
| | 150 | | } |
| 0 | 151 | | catch (Exception e) |
| | 152 | | { |
| 0 | 153 | | scope.Failed(e); |
| 0 | 154 | | throw; |
| | 155 | | } |
| 2 | 156 | | } |
| | 157 | |
|
| | 158 | | /// <summary> Retrieves information about a dedicated host group. </summary> |
| | 159 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 160 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 161 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 162 | | public virtual async Task<Response<DedicatedHostGroup>> GetAsync(string resourceGroupName, string hostGroupName, |
| | 163 | | { |
| 4 | 164 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostGroupsOperations.Get"); |
| 4 | 165 | | scope.Start(); |
| | 166 | | try |
| | 167 | | { |
| 4 | 168 | | return await RestClient.GetAsync(resourceGroupName, hostGroupName, cancellationToken).ConfigureAwait(fal |
| | 169 | | } |
| 0 | 170 | | catch (Exception e) |
| | 171 | | { |
| 0 | 172 | | scope.Failed(e); |
| 0 | 173 | | throw; |
| | 174 | | } |
| 4 | 175 | | } |
| | 176 | |
|
| | 177 | | /// <summary> Retrieves information about a dedicated host group. </summary> |
| | 178 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 179 | | /// <param name="hostGroupName"> The name of the dedicated host group. </param> |
| | 180 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 181 | | public virtual Response<DedicatedHostGroup> Get(string resourceGroupName, string hostGroupName, CancellationToke |
| | 182 | | { |
| 4 | 183 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostGroupsOperations.Get"); |
| 4 | 184 | | scope.Start(); |
| | 185 | | try |
| | 186 | | { |
| 4 | 187 | | return RestClient.Get(resourceGroupName, hostGroupName, cancellationToken); |
| | 188 | | } |
| 0 | 189 | | catch (Exception e) |
| | 190 | | { |
| 0 | 191 | | scope.Failed(e); |
| 0 | 192 | | throw; |
| | 193 | | } |
| 4 | 194 | | } |
| | 195 | |
|
| | 196 | | /// <summary> Lists all of the dedicated host groups in the specified resource group. Use the nextLink property |
| | 197 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 198 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 199 | | public virtual AsyncPageable<DedicatedHostGroup> ListByResourceGroupAsync(string resourceGroupName, Cancellation |
| | 200 | | { |
| 2 | 201 | | if (resourceGroupName == null) |
| | 202 | | { |
| 0 | 203 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 204 | | } |
| | 205 | |
|
| | 206 | | async Task<Page<DedicatedHostGroup>> FirstPageFunc(int? pageSizeHint) |
| | 207 | | { |
| 2 | 208 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostGroupsOperations.ListByResourceGroup"); |
| 2 | 209 | | scope.Start(); |
| | 210 | | try |
| | 211 | | { |
| 2 | 212 | | var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).Confi |
| 2 | 213 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 214 | | } |
| 0 | 215 | | catch (Exception e) |
| | 216 | | { |
| 0 | 217 | | scope.Failed(e); |
| 0 | 218 | | throw; |
| | 219 | | } |
| 2 | 220 | | } |
| | 221 | | async Task<Page<DedicatedHostGroup>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 222 | | { |
| 0 | 223 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostGroupsOperations.ListByResourceGroup"); |
| 0 | 224 | | scope.Start(); |
| | 225 | | try |
| | 226 | | { |
| 0 | 227 | | var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancel |
| 0 | 228 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 229 | | } |
| 0 | 230 | | catch (Exception e) |
| | 231 | | { |
| 0 | 232 | | scope.Failed(e); |
| 0 | 233 | | throw; |
| | 234 | | } |
| 0 | 235 | | } |
| 2 | 236 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 237 | | } |
| | 238 | |
|
| | 239 | | /// <summary> Lists all of the dedicated host groups in the specified resource group. Use the nextLink property |
| | 240 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 241 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 242 | | public virtual Pageable<DedicatedHostGroup> ListByResourceGroup(string resourceGroupName, CancellationToken canc |
| | 243 | | { |
| 2 | 244 | | if (resourceGroupName == null) |
| | 245 | | { |
| 0 | 246 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 247 | | } |
| | 248 | |
|
| | 249 | | Page<DedicatedHostGroup> FirstPageFunc(int? pageSizeHint) |
| | 250 | | { |
| 2 | 251 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostGroupsOperations.ListByResourceGroup"); |
| 2 | 252 | | scope.Start(); |
| | 253 | | try |
| | 254 | | { |
| 2 | 255 | | var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken); |
| 2 | 256 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 257 | | } |
| 0 | 258 | | catch (Exception e) |
| | 259 | | { |
| 0 | 260 | | scope.Failed(e); |
| 0 | 261 | | throw; |
| | 262 | | } |
| 2 | 263 | | } |
| | 264 | | Page<DedicatedHostGroup> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 265 | | { |
| 0 | 266 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostGroupsOperations.ListByResourceGroup"); |
| 0 | 267 | | scope.Start(); |
| | 268 | | try |
| | 269 | | { |
| 0 | 270 | | var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken |
| 0 | 271 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 272 | | } |
| 0 | 273 | | catch (Exception e) |
| | 274 | | { |
| 0 | 275 | | scope.Failed(e); |
| 0 | 276 | | throw; |
| | 277 | | } |
| 0 | 278 | | } |
| 2 | 279 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 280 | | } |
| | 281 | |
|
| | 282 | | /// <summary> Lists all of the dedicated host groups in the subscription. Use the nextLink property in the respo |
| | 283 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 284 | | public virtual AsyncPageable<DedicatedHostGroup> ListBySubscriptionAsync(CancellationToken cancellationToken = d |
| | 285 | | { |
| | 286 | | async Task<Page<DedicatedHostGroup>> FirstPageFunc(int? pageSizeHint) |
| | 287 | | { |
| 2 | 288 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostGroupsOperations.ListBySubscription"); |
| 2 | 289 | | scope.Start(); |
| | 290 | | try |
| | 291 | | { |
| 2 | 292 | | var response = await RestClient.ListBySubscriptionAsync(cancellationToken).ConfigureAwait(false); |
| 2 | 293 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 294 | | } |
| 0 | 295 | | catch (Exception e) |
| | 296 | | { |
| 0 | 297 | | scope.Failed(e); |
| 0 | 298 | | throw; |
| | 299 | | } |
| 2 | 300 | | } |
| | 301 | | async Task<Page<DedicatedHostGroup>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 302 | | { |
| 0 | 303 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostGroupsOperations.ListBySubscription"); |
| 0 | 304 | | scope.Start(); |
| | 305 | | try |
| | 306 | | { |
| 0 | 307 | | var response = await RestClient.ListBySubscriptionNextPageAsync(nextLink, cancellationToken).Configu |
| 0 | 308 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 309 | | } |
| 0 | 310 | | catch (Exception e) |
| | 311 | | { |
| 0 | 312 | | scope.Failed(e); |
| 0 | 313 | | throw; |
| | 314 | | } |
| 0 | 315 | | } |
| 2 | 316 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 317 | | } |
| | 318 | |
|
| | 319 | | /// <summary> Lists all of the dedicated host groups in the subscription. Use the nextLink property in the respo |
| | 320 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 321 | | public virtual Pageable<DedicatedHostGroup> ListBySubscription(CancellationToken cancellationToken = default) |
| | 322 | | { |
| | 323 | | Page<DedicatedHostGroup> FirstPageFunc(int? pageSizeHint) |
| | 324 | | { |
| 2 | 325 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostGroupsOperations.ListBySubscription"); |
| 2 | 326 | | scope.Start(); |
| | 327 | | try |
| | 328 | | { |
| 2 | 329 | | var response = RestClient.ListBySubscription(cancellationToken); |
| 2 | 330 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 331 | | } |
| 0 | 332 | | catch (Exception e) |
| | 333 | | { |
| 0 | 334 | | scope.Failed(e); |
| 0 | 335 | | throw; |
| | 336 | | } |
| 2 | 337 | | } |
| | 338 | | Page<DedicatedHostGroup> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 339 | | { |
| 0 | 340 | | using var scope = _clientDiagnostics.CreateScope("DedicatedHostGroupsOperations.ListBySubscription"); |
| 0 | 341 | | scope.Start(); |
| | 342 | | try |
| | 343 | | { |
| 0 | 344 | | var response = RestClient.ListBySubscriptionNextPage(nextLink, cancellationToken); |
| 0 | 345 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 346 | | } |
| 0 | 347 | | catch (Exception e) |
| | 348 | | { |
| 0 | 349 | | scope.Failed(e); |
| 0 | 350 | | throw; |
| | 351 | | } |
| 0 | 352 | | } |
| 2 | 353 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 354 | | } |
| | 355 | | } |
| | 356 | | } |