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