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