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