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