| | 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.Network.Models; |
| | 15 | |
|
| | 16 | | namespace Azure.ResourceManager.Network |
| | 17 | | { |
| | 18 | | /// <summary> The PublicIPPrefixes service client. </summary> |
| | 19 | | public partial class PublicIPPrefixesOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 0 | 23 | | internal PublicIPPrefixesRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of PublicIPPrefixesOperations for mocking. </summary> |
| 0 | 25 | | protected PublicIPPrefixesOperations() |
| | 26 | | { |
| 0 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of PublicIPPrefixesOperations. </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"> The subscription credentials which uniquely identify the Microsoft Azure subsc |
| | 32 | | /// <param name="endpoint"> server parameter. </param> |
| 0 | 33 | | internal PublicIPPrefixesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscript |
| | 34 | | { |
| 0 | 35 | | RestClient = new PublicIPPrefixesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 0 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 37 | | _pipeline = pipeline; |
| 0 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Gets the specified public IP prefix in a specified resource group. </summary> |
| | 41 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 42 | | /// <param name="publicIpPrefixName"> The name of the public IP prefix. </param> |
| | 43 | | /// <param name="expand"> Expands referenced resources. </param> |
| | 44 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 45 | | public virtual async Task<Response<PublicIPPrefix>> GetAsync(string resourceGroupName, string publicIpPrefixName |
| | 46 | | { |
| 0 | 47 | | using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.Get"); |
| 0 | 48 | | scope.Start(); |
| | 49 | | try |
| | 50 | | { |
| 0 | 51 | | return await RestClient.GetAsync(resourceGroupName, publicIpPrefixName, expand, cancellationToken).Confi |
| | 52 | | } |
| 0 | 53 | | catch (Exception e) |
| | 54 | | { |
| 0 | 55 | | scope.Failed(e); |
| 0 | 56 | | throw; |
| | 57 | | } |
| 0 | 58 | | } |
| | 59 | |
|
| | 60 | | /// <summary> Gets the specified public IP prefix in a specified resource group. </summary> |
| | 61 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 62 | | /// <param name="publicIpPrefixName"> The name of the public IP prefix. </param> |
| | 63 | | /// <param name="expand"> Expands referenced resources. </param> |
| | 64 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 65 | | public virtual Response<PublicIPPrefix> Get(string resourceGroupName, string publicIpPrefixName, string expand = |
| | 66 | | { |
| 0 | 67 | | using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.Get"); |
| 0 | 68 | | scope.Start(); |
| | 69 | | try |
| | 70 | | { |
| 0 | 71 | | return RestClient.Get(resourceGroupName, publicIpPrefixName, expand, cancellationToken); |
| | 72 | | } |
| 0 | 73 | | catch (Exception e) |
| | 74 | | { |
| 0 | 75 | | scope.Failed(e); |
| 0 | 76 | | throw; |
| | 77 | | } |
| 0 | 78 | | } |
| | 79 | |
|
| | 80 | | /// <summary> Updates public IP prefix tags. </summary> |
| | 81 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 82 | | /// <param name="publicIpPrefixName"> The name of the public IP prefix. </param> |
| | 83 | | /// <param name="parameters"> Parameters supplied to update public IP prefix tags. </param> |
| | 84 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 85 | | public virtual async Task<Response<PublicIPPrefix>> UpdateTagsAsync(string resourceGroupName, string publicIpPre |
| | 86 | | { |
| 0 | 87 | | using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.UpdateTags"); |
| 0 | 88 | | scope.Start(); |
| | 89 | | try |
| | 90 | | { |
| 0 | 91 | | return await RestClient.UpdateTagsAsync(resourceGroupName, publicIpPrefixName, parameters, cancellationT |
| | 92 | | } |
| 0 | 93 | | catch (Exception e) |
| | 94 | | { |
| 0 | 95 | | scope.Failed(e); |
| 0 | 96 | | throw; |
| | 97 | | } |
| 0 | 98 | | } |
| | 99 | |
|
| | 100 | | /// <summary> Updates public IP prefix tags. </summary> |
| | 101 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 102 | | /// <param name="publicIpPrefixName"> The name of the public IP prefix. </param> |
| | 103 | | /// <param name="parameters"> Parameters supplied to update public IP prefix tags. </param> |
| | 104 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 105 | | public virtual Response<PublicIPPrefix> UpdateTags(string resourceGroupName, string publicIpPrefixName, TagsObje |
| | 106 | | { |
| 0 | 107 | | using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.UpdateTags"); |
| 0 | 108 | | scope.Start(); |
| | 109 | | try |
| | 110 | | { |
| 0 | 111 | | return RestClient.UpdateTags(resourceGroupName, publicIpPrefixName, parameters, cancellationToken); |
| | 112 | | } |
| 0 | 113 | | catch (Exception e) |
| | 114 | | { |
| 0 | 115 | | scope.Failed(e); |
| 0 | 116 | | throw; |
| | 117 | | } |
| 0 | 118 | | } |
| | 119 | |
|
| | 120 | | /// <summary> Gets all the public IP prefixes in a subscription. </summary> |
| | 121 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 122 | | public virtual AsyncPageable<PublicIPPrefix> ListAllAsync(CancellationToken cancellationToken = default) |
| | 123 | | { |
| | 124 | | async Task<Page<PublicIPPrefix>> FirstPageFunc(int? pageSizeHint) |
| | 125 | | { |
| 0 | 126 | | using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.ListAll"); |
| 0 | 127 | | scope.Start(); |
| | 128 | | try |
| | 129 | | { |
| 0 | 130 | | var response = await RestClient.ListAllAsync(cancellationToken).ConfigureAwait(false); |
| 0 | 131 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 132 | | } |
| 0 | 133 | | catch (Exception e) |
| | 134 | | { |
| 0 | 135 | | scope.Failed(e); |
| 0 | 136 | | throw; |
| | 137 | | } |
| 0 | 138 | | } |
| | 139 | | async Task<Page<PublicIPPrefix>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 140 | | { |
| 0 | 141 | | using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.ListAll"); |
| 0 | 142 | | scope.Start(); |
| | 143 | | try |
| | 144 | | { |
| 0 | 145 | | var response = await RestClient.ListAllNextPageAsync(nextLink, cancellationToken).ConfigureAwait(fal |
| 0 | 146 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 147 | | } |
| 0 | 148 | | catch (Exception e) |
| | 149 | | { |
| 0 | 150 | | scope.Failed(e); |
| 0 | 151 | | throw; |
| | 152 | | } |
| 0 | 153 | | } |
| 0 | 154 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 155 | | } |
| | 156 | |
|
| | 157 | | /// <summary> Gets all the public IP prefixes in a subscription. </summary> |
| | 158 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 159 | | public virtual Pageable<PublicIPPrefix> ListAll(CancellationToken cancellationToken = default) |
| | 160 | | { |
| | 161 | | Page<PublicIPPrefix> FirstPageFunc(int? pageSizeHint) |
| | 162 | | { |
| 0 | 163 | | using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.ListAll"); |
| 0 | 164 | | scope.Start(); |
| | 165 | | try |
| | 166 | | { |
| 0 | 167 | | var response = RestClient.ListAll(cancellationToken); |
| 0 | 168 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 169 | | } |
| 0 | 170 | | catch (Exception e) |
| | 171 | | { |
| 0 | 172 | | scope.Failed(e); |
| 0 | 173 | | throw; |
| | 174 | | } |
| 0 | 175 | | } |
| | 176 | | Page<PublicIPPrefix> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 177 | | { |
| 0 | 178 | | using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.ListAll"); |
| 0 | 179 | | scope.Start(); |
| | 180 | | try |
| | 181 | | { |
| 0 | 182 | | var response = RestClient.ListAllNextPage(nextLink, cancellationToken); |
| 0 | 183 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 184 | | } |
| 0 | 185 | | catch (Exception e) |
| | 186 | | { |
| 0 | 187 | | scope.Failed(e); |
| 0 | 188 | | throw; |
| | 189 | | } |
| 0 | 190 | | } |
| 0 | 191 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 192 | | } |
| | 193 | |
|
| | 194 | | /// <summary> Gets all public IP prefixes in a resource group. </summary> |
| | 195 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 196 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 197 | | public virtual AsyncPageable<PublicIPPrefix> ListAsync(string resourceGroupName, CancellationToken cancellationT |
| | 198 | | { |
| 0 | 199 | | if (resourceGroupName == null) |
| | 200 | | { |
| 0 | 201 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 202 | | } |
| | 203 | |
|
| | 204 | | async Task<Page<PublicIPPrefix>> FirstPageFunc(int? pageSizeHint) |
| | 205 | | { |
| 0 | 206 | | using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.List"); |
| 0 | 207 | | scope.Start(); |
| | 208 | | try |
| | 209 | | { |
| 0 | 210 | | var response = await RestClient.ListAsync(resourceGroupName, cancellationToken).ConfigureAwait(false |
| 0 | 211 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 212 | | } |
| 0 | 213 | | catch (Exception e) |
| | 214 | | { |
| 0 | 215 | | scope.Failed(e); |
| 0 | 216 | | throw; |
| | 217 | | } |
| 0 | 218 | | } |
| | 219 | | async Task<Page<PublicIPPrefix>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 220 | | { |
| 0 | 221 | | using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.List"); |
| 0 | 222 | | scope.Start(); |
| | 223 | | try |
| | 224 | | { |
| 0 | 225 | | var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, cancellationToken).Co |
| 0 | 226 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 227 | | } |
| 0 | 228 | | catch (Exception e) |
| | 229 | | { |
| 0 | 230 | | scope.Failed(e); |
| 0 | 231 | | throw; |
| | 232 | | } |
| 0 | 233 | | } |
| 0 | 234 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 235 | | } |
| | 236 | |
|
| | 237 | | /// <summary> Gets all public IP prefixes in a resource group. </summary> |
| | 238 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 239 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 240 | | public virtual Pageable<PublicIPPrefix> List(string resourceGroupName, CancellationToken cancellationToken = def |
| | 241 | | { |
| 0 | 242 | | if (resourceGroupName == null) |
| | 243 | | { |
| 0 | 244 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 245 | | } |
| | 246 | |
|
| | 247 | | Page<PublicIPPrefix> FirstPageFunc(int? pageSizeHint) |
| | 248 | | { |
| 0 | 249 | | using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.List"); |
| 0 | 250 | | scope.Start(); |
| | 251 | | try |
| | 252 | | { |
| 0 | 253 | | var response = RestClient.List(resourceGroupName, cancellationToken); |
| 0 | 254 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 255 | | } |
| 0 | 256 | | catch (Exception e) |
| | 257 | | { |
| 0 | 258 | | scope.Failed(e); |
| 0 | 259 | | throw; |
| | 260 | | } |
| 0 | 261 | | } |
| | 262 | | Page<PublicIPPrefix> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 263 | | { |
| 0 | 264 | | using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.List"); |
| 0 | 265 | | scope.Start(); |
| | 266 | | try |
| | 267 | | { |
| 0 | 268 | | var response = RestClient.ListNextPage(nextLink, resourceGroupName, cancellationToken); |
| 0 | 269 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 270 | | } |
| 0 | 271 | | catch (Exception e) |
| | 272 | | { |
| 0 | 273 | | scope.Failed(e); |
| 0 | 274 | | throw; |
| | 275 | | } |
| 0 | 276 | | } |
| 0 | 277 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 278 | | } |
| | 279 | |
|
| | 280 | | /// <summary> Deletes the specified public IP prefix. </summary> |
| | 281 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 282 | | /// <param name="publicIpPrefixName"> The name of the PublicIpPrefix. </param> |
| | 283 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 284 | | public virtual async Task<PublicIPPrefixesDeleteOperation> StartDeleteAsync(string resourceGroupName, string pub |
| | 285 | | { |
| 0 | 286 | | if (resourceGroupName == null) |
| | 287 | | { |
| 0 | 288 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 289 | | } |
| 0 | 290 | | if (publicIpPrefixName == null) |
| | 291 | | { |
| 0 | 292 | | throw new ArgumentNullException(nameof(publicIpPrefixName)); |
| | 293 | | } |
| | 294 | |
|
| 0 | 295 | | using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.StartDelete"); |
| 0 | 296 | | scope.Start(); |
| | 297 | | try |
| | 298 | | { |
| 0 | 299 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, publicIpPrefixName, cancellationT |
| 0 | 300 | | return new PublicIPPrefixesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest |
| | 301 | | } |
| 0 | 302 | | catch (Exception e) |
| | 303 | | { |
| 0 | 304 | | scope.Failed(e); |
| 0 | 305 | | throw; |
| | 306 | | } |
| 0 | 307 | | } |
| | 308 | |
|
| | 309 | | /// <summary> Deletes the specified public IP prefix. </summary> |
| | 310 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 311 | | /// <param name="publicIpPrefixName"> The name of the PublicIpPrefix. </param> |
| | 312 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 313 | | public virtual PublicIPPrefixesDeleteOperation StartDelete(string resourceGroupName, string publicIpPrefixName, |
| | 314 | | { |
| 0 | 315 | | if (resourceGroupName == null) |
| | 316 | | { |
| 0 | 317 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 318 | | } |
| 0 | 319 | | if (publicIpPrefixName == null) |
| | 320 | | { |
| 0 | 321 | | throw new ArgumentNullException(nameof(publicIpPrefixName)); |
| | 322 | | } |
| | 323 | |
|
| 0 | 324 | | using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.StartDelete"); |
| 0 | 325 | | scope.Start(); |
| | 326 | | try |
| | 327 | | { |
| 0 | 328 | | var originalResponse = RestClient.Delete(resourceGroupName, publicIpPrefixName, cancellationToken); |
| 0 | 329 | | return new PublicIPPrefixesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest |
| | 330 | | } |
| 0 | 331 | | catch (Exception e) |
| | 332 | | { |
| 0 | 333 | | scope.Failed(e); |
| 0 | 334 | | throw; |
| | 335 | | } |
| 0 | 336 | | } |
| | 337 | |
|
| | 338 | | /// <summary> Creates or updates a static or dynamic public IP prefix. </summary> |
| | 339 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 340 | | /// <param name="publicIpPrefixName"> The name of the public IP prefix. </param> |
| | 341 | | /// <param name="parameters"> Parameters supplied to the create or update public IP prefix operation. </param> |
| | 342 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 343 | | public virtual async Task<PublicIPPrefixesCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroup |
| | 344 | | { |
| 0 | 345 | | if (resourceGroupName == null) |
| | 346 | | { |
| 0 | 347 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 348 | | } |
| 0 | 349 | | if (publicIpPrefixName == null) |
| | 350 | | { |
| 0 | 351 | | throw new ArgumentNullException(nameof(publicIpPrefixName)); |
| | 352 | | } |
| 0 | 353 | | if (parameters == null) |
| | 354 | | { |
| 0 | 355 | | throw new ArgumentNullException(nameof(parameters)); |
| | 356 | | } |
| | 357 | |
|
| 0 | 358 | | using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.StartCreateOrUpdate"); |
| 0 | 359 | | scope.Start(); |
| | 360 | | try |
| | 361 | | { |
| 0 | 362 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, publicIpPrefixName, param |
| 0 | 363 | | return new PublicIPPrefixesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreat |
| | 364 | | } |
| 0 | 365 | | catch (Exception e) |
| | 366 | | { |
| 0 | 367 | | scope.Failed(e); |
| 0 | 368 | | throw; |
| | 369 | | } |
| 0 | 370 | | } |
| | 371 | |
|
| | 372 | | /// <summary> Creates or updates a static or dynamic public IP prefix. </summary> |
| | 373 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 374 | | /// <param name="publicIpPrefixName"> The name of the public IP prefix. </param> |
| | 375 | | /// <param name="parameters"> Parameters supplied to the create or update public IP prefix operation. </param> |
| | 376 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 377 | | public virtual PublicIPPrefixesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string publ |
| | 378 | | { |
| 0 | 379 | | if (resourceGroupName == null) |
| | 380 | | { |
| 0 | 381 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 382 | | } |
| 0 | 383 | | if (publicIpPrefixName == null) |
| | 384 | | { |
| 0 | 385 | | throw new ArgumentNullException(nameof(publicIpPrefixName)); |
| | 386 | | } |
| 0 | 387 | | if (parameters == null) |
| | 388 | | { |
| 0 | 389 | | throw new ArgumentNullException(nameof(parameters)); |
| | 390 | | } |
| | 391 | |
|
| 0 | 392 | | using var scope = _clientDiagnostics.CreateScope("PublicIPPrefixesOperations.StartCreateOrUpdate"); |
| 0 | 393 | | scope.Start(); |
| | 394 | | try |
| | 395 | | { |
| 0 | 396 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, publicIpPrefixName, parameters, canc |
| 0 | 397 | | return new PublicIPPrefixesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreat |
| | 398 | | } |
| 0 | 399 | | catch (Exception e) |
| | 400 | | { |
| 0 | 401 | | scope.Failed(e); |
| 0 | 402 | | throw; |
| | 403 | | } |
| 0 | 404 | | } |
| | 405 | | } |
| | 406 | | } |