| | 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.EventHubs.Models; |
| | 15 | |
|
| | 16 | | namespace Azure.ResourceManager.EventHubs |
| | 17 | | { |
| | 18 | | /// <summary> The Clusters service client. </summary> |
| | 19 | | public partial class ClustersOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 0 | 23 | | internal ClustersRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of ClustersOperations for mocking. </summary> |
| 0 | 25 | | protected ClustersOperations() |
| | 26 | | { |
| 0 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of ClustersOperations. </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 that uniquely identify a Microsoft Azure subscription |
| | 32 | | /// <param name="endpoint"> server parameter. </param> |
| 0 | 33 | | internal ClustersOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, U |
| | 34 | | { |
| 0 | 35 | | RestClient = new ClustersRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 0 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 37 | | _pipeline = pipeline; |
| 0 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> List the quantity of available pre-provisioned Event Hubs Clusters, indexed by Azure region. </sum |
| | 41 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 42 | | public virtual async Task<Response<AvailableClustersList>> ListAvailableClustersAsync(CancellationToken cancella |
| | 43 | | { |
| 0 | 44 | | using var scope = _clientDiagnostics.CreateScope("ClustersOperations.ListAvailableClusters"); |
| 0 | 45 | | scope.Start(); |
| | 46 | | try |
| | 47 | | { |
| 0 | 48 | | return await RestClient.ListAvailableClustersAsync(cancellationToken).ConfigureAwait(false); |
| | 49 | | } |
| 0 | 50 | | catch (Exception e) |
| | 51 | | { |
| 0 | 52 | | scope.Failed(e); |
| 0 | 53 | | throw; |
| | 54 | | } |
| 0 | 55 | | } |
| | 56 | |
|
| | 57 | | /// <summary> List the quantity of available pre-provisioned Event Hubs Clusters, indexed by Azure region. </sum |
| | 58 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 59 | | public virtual Response<AvailableClustersList> ListAvailableClusters(CancellationToken cancellationToken = defau |
| | 60 | | { |
| 0 | 61 | | using var scope = _clientDiagnostics.CreateScope("ClustersOperations.ListAvailableClusters"); |
| 0 | 62 | | scope.Start(); |
| | 63 | | try |
| | 64 | | { |
| 0 | 65 | | return RestClient.ListAvailableClusters(cancellationToken); |
| | 66 | | } |
| 0 | 67 | | catch (Exception e) |
| | 68 | | { |
| 0 | 69 | | scope.Failed(e); |
| 0 | 70 | | throw; |
| | 71 | | } |
| 0 | 72 | | } |
| | 73 | |
|
| | 74 | | /// <summary> Gets the resource description of the specified Event Hubs Cluster. </summary> |
| | 75 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 76 | | /// <param name="clusterName"> The name of the Event Hubs Cluster. </param> |
| | 77 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 78 | | public virtual async Task<Response<Cluster>> GetAsync(string resourceGroupName, string clusterName, Cancellation |
| | 79 | | { |
| 0 | 80 | | using var scope = _clientDiagnostics.CreateScope("ClustersOperations.Get"); |
| 0 | 81 | | scope.Start(); |
| | 82 | | try |
| | 83 | | { |
| 0 | 84 | | return await RestClient.GetAsync(resourceGroupName, clusterName, cancellationToken).ConfigureAwait(false |
| | 85 | | } |
| 0 | 86 | | catch (Exception e) |
| | 87 | | { |
| 0 | 88 | | scope.Failed(e); |
| 0 | 89 | | throw; |
| | 90 | | } |
| 0 | 91 | | } |
| | 92 | |
|
| | 93 | | /// <summary> Gets the resource description of the specified Event Hubs Cluster. </summary> |
| | 94 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 95 | | /// <param name="clusterName"> The name of the Event Hubs Cluster. </param> |
| | 96 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 97 | | public virtual Response<Cluster> Get(string resourceGroupName, string clusterName, CancellationToken cancellatio |
| | 98 | | { |
| 0 | 99 | | using var scope = _clientDiagnostics.CreateScope("ClustersOperations.Get"); |
| 0 | 100 | | scope.Start(); |
| | 101 | | try |
| | 102 | | { |
| 0 | 103 | | return RestClient.Get(resourceGroupName, clusterName, cancellationToken); |
| | 104 | | } |
| 0 | 105 | | catch (Exception e) |
| | 106 | | { |
| 0 | 107 | | scope.Failed(e); |
| 0 | 108 | | throw; |
| | 109 | | } |
| 0 | 110 | | } |
| | 111 | |
|
| | 112 | | /// <summary> List all Event Hubs Namespace IDs in an Event Hubs Dedicated Cluster. </summary> |
| | 113 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 114 | | /// <param name="clusterName"> The name of the Event Hubs Cluster. </param> |
| | 115 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 116 | | public virtual async Task<Response<EHNamespaceIdListResult>> ListNamespacesAsync(string resourceGroupName, strin |
| | 117 | | { |
| 0 | 118 | | using var scope = _clientDiagnostics.CreateScope("ClustersOperations.ListNamespaces"); |
| 0 | 119 | | scope.Start(); |
| | 120 | | try |
| | 121 | | { |
| 0 | 122 | | return await RestClient.ListNamespacesAsync(resourceGroupName, clusterName, cancellationToken).Configure |
| | 123 | | } |
| 0 | 124 | | catch (Exception e) |
| | 125 | | { |
| 0 | 126 | | scope.Failed(e); |
| 0 | 127 | | throw; |
| | 128 | | } |
| 0 | 129 | | } |
| | 130 | |
|
| | 131 | | /// <summary> List all Event Hubs Namespace IDs in an Event Hubs Dedicated Cluster. </summary> |
| | 132 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 133 | | /// <param name="clusterName"> The name of the Event Hubs Cluster. </param> |
| | 134 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 135 | | public virtual Response<EHNamespaceIdListResult> ListNamespaces(string resourceGroupName, string clusterName, Ca |
| | 136 | | { |
| 0 | 137 | | using var scope = _clientDiagnostics.CreateScope("ClustersOperations.ListNamespaces"); |
| 0 | 138 | | scope.Start(); |
| | 139 | | try |
| | 140 | | { |
| 0 | 141 | | return RestClient.ListNamespaces(resourceGroupName, clusterName, cancellationToken); |
| | 142 | | } |
| 0 | 143 | | catch (Exception e) |
| | 144 | | { |
| 0 | 145 | | scope.Failed(e); |
| 0 | 146 | | throw; |
| | 147 | | } |
| 0 | 148 | | } |
| | 149 | |
|
| | 150 | | /// <summary> Lists the available Event Hubs Clusters within an ARM resource group. </summary> |
| | 151 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 152 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 153 | | public virtual AsyncPageable<Cluster> ListByResourceGroupAsync(string resourceGroupName, CancellationToken cance |
| | 154 | | { |
| 0 | 155 | | if (resourceGroupName == null) |
| | 156 | | { |
| 0 | 157 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 158 | | } |
| | 159 | |
|
| | 160 | | async Task<Page<Cluster>> FirstPageFunc(int? pageSizeHint) |
| | 161 | | { |
| 0 | 162 | | using var scope = _clientDiagnostics.CreateScope("ClustersOperations.ListByResourceGroup"); |
| 0 | 163 | | scope.Start(); |
| | 164 | | try |
| | 165 | | { |
| 0 | 166 | | var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).Confi |
| 0 | 167 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 168 | | } |
| 0 | 169 | | catch (Exception e) |
| | 170 | | { |
| 0 | 171 | | scope.Failed(e); |
| 0 | 172 | | throw; |
| | 173 | | } |
| 0 | 174 | | } |
| | 175 | | async Task<Page<Cluster>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 176 | | { |
| 0 | 177 | | using var scope = _clientDiagnostics.CreateScope("ClustersOperations.ListByResourceGroup"); |
| 0 | 178 | | scope.Start(); |
| | 179 | | try |
| | 180 | | { |
| 0 | 181 | | var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancel |
| 0 | 182 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 183 | | } |
| 0 | 184 | | catch (Exception e) |
| | 185 | | { |
| 0 | 186 | | scope.Failed(e); |
| 0 | 187 | | throw; |
| | 188 | | } |
| 0 | 189 | | } |
| 0 | 190 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 191 | | } |
| | 192 | |
|
| | 193 | | /// <summary> Lists the available Event Hubs Clusters within an ARM resource group. </summary> |
| | 194 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 195 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 196 | | public virtual Pageable<Cluster> ListByResourceGroup(string resourceGroupName, CancellationToken cancellationTok |
| | 197 | | { |
| 0 | 198 | | if (resourceGroupName == null) |
| | 199 | | { |
| 0 | 200 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 201 | | } |
| | 202 | |
|
| | 203 | | Page<Cluster> FirstPageFunc(int? pageSizeHint) |
| | 204 | | { |
| 0 | 205 | | using var scope = _clientDiagnostics.CreateScope("ClustersOperations.ListByResourceGroup"); |
| 0 | 206 | | scope.Start(); |
| | 207 | | try |
| | 208 | | { |
| 0 | 209 | | var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken); |
| 0 | 210 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 211 | | } |
| 0 | 212 | | catch (Exception e) |
| | 213 | | { |
| 0 | 214 | | scope.Failed(e); |
| 0 | 215 | | throw; |
| | 216 | | } |
| 0 | 217 | | } |
| | 218 | | Page<Cluster> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 219 | | { |
| 0 | 220 | | using var scope = _clientDiagnostics.CreateScope("ClustersOperations.ListByResourceGroup"); |
| 0 | 221 | | scope.Start(); |
| | 222 | | try |
| | 223 | | { |
| 0 | 224 | | var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken |
| 0 | 225 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 226 | | } |
| 0 | 227 | | catch (Exception e) |
| | 228 | | { |
| 0 | 229 | | scope.Failed(e); |
| 0 | 230 | | throw; |
| | 231 | | } |
| 0 | 232 | | } |
| 0 | 233 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 234 | | } |
| | 235 | |
|
| | 236 | | /// <summary> Creates or updates an instance of an Event Hubs Cluster. </summary> |
| | 237 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 238 | | /// <param name="clusterName"> The name of the Event Hubs Cluster. </param> |
| | 239 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 240 | | public virtual async Task<ClustersPutOperation> StartPutAsync(string resourceGroupName, string clusterName, Canc |
| | 241 | | { |
| 0 | 242 | | if (resourceGroupName == null) |
| | 243 | | { |
| 0 | 244 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 245 | | } |
| 0 | 246 | | if (clusterName == null) |
| | 247 | | { |
| 0 | 248 | | throw new ArgumentNullException(nameof(clusterName)); |
| | 249 | | } |
| | 250 | |
|
| 0 | 251 | | using var scope = _clientDiagnostics.CreateScope("ClustersOperations.StartPut"); |
| 0 | 252 | | scope.Start(); |
| | 253 | | try |
| | 254 | | { |
| 0 | 255 | | var originalResponse = await RestClient.PutAsync(resourceGroupName, clusterName, cancellationToken).Conf |
| 0 | 256 | | return new ClustersPutOperation(_clientDiagnostics, _pipeline, RestClient.CreatePutRequest(resourceGroup |
| | 257 | | } |
| 0 | 258 | | catch (Exception e) |
| | 259 | | { |
| 0 | 260 | | scope.Failed(e); |
| 0 | 261 | | throw; |
| | 262 | | } |
| 0 | 263 | | } |
| | 264 | |
|
| | 265 | | /// <summary> Creates or updates an instance of an Event Hubs Cluster. </summary> |
| | 266 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 267 | | /// <param name="clusterName"> The name of the Event Hubs Cluster. </param> |
| | 268 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 269 | | public virtual ClustersPutOperation StartPut(string resourceGroupName, string clusterName, CancellationToken can |
| | 270 | | { |
| 0 | 271 | | if (resourceGroupName == null) |
| | 272 | | { |
| 0 | 273 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 274 | | } |
| 0 | 275 | | if (clusterName == null) |
| | 276 | | { |
| 0 | 277 | | throw new ArgumentNullException(nameof(clusterName)); |
| | 278 | | } |
| | 279 | |
|
| 0 | 280 | | using var scope = _clientDiagnostics.CreateScope("ClustersOperations.StartPut"); |
| 0 | 281 | | scope.Start(); |
| | 282 | | try |
| | 283 | | { |
| 0 | 284 | | var originalResponse = RestClient.Put(resourceGroupName, clusterName, cancellationToken); |
| 0 | 285 | | return new ClustersPutOperation(_clientDiagnostics, _pipeline, RestClient.CreatePutRequest(resourceGroup |
| | 286 | | } |
| 0 | 287 | | catch (Exception e) |
| | 288 | | { |
| 0 | 289 | | scope.Failed(e); |
| 0 | 290 | | throw; |
| | 291 | | } |
| 0 | 292 | | } |
| | 293 | |
|
| | 294 | | /// <summary> Modifies mutable properties on the Event Hubs Cluster. This operation is idempotent. </summary> |
| | 295 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 296 | | /// <param name="clusterName"> The name of the Event Hubs Cluster. </param> |
| | 297 | | /// <param name="parameters"> The properties of the Event Hubs Cluster which should be updated. </param> |
| | 298 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 299 | | public virtual async Task<ClustersPatchOperation> StartPatchAsync(string resourceGroupName, string clusterName, |
| | 300 | | { |
| 0 | 301 | | if (resourceGroupName == null) |
| | 302 | | { |
| 0 | 303 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 304 | | } |
| 0 | 305 | | if (clusterName == null) |
| | 306 | | { |
| 0 | 307 | | throw new ArgumentNullException(nameof(clusterName)); |
| | 308 | | } |
| 0 | 309 | | if (parameters == null) |
| | 310 | | { |
| 0 | 311 | | throw new ArgumentNullException(nameof(parameters)); |
| | 312 | | } |
| | 313 | |
|
| 0 | 314 | | using var scope = _clientDiagnostics.CreateScope("ClustersOperations.StartPatch"); |
| 0 | 315 | | scope.Start(); |
| | 316 | | try |
| | 317 | | { |
| 0 | 318 | | var originalResponse = await RestClient.PatchAsync(resourceGroupName, clusterName, parameters, cancellat |
| 0 | 319 | | return new ClustersPatchOperation(_clientDiagnostics, _pipeline, RestClient.CreatePatchRequest(resourceG |
| | 320 | | } |
| 0 | 321 | | catch (Exception e) |
| | 322 | | { |
| 0 | 323 | | scope.Failed(e); |
| 0 | 324 | | throw; |
| | 325 | | } |
| 0 | 326 | | } |
| | 327 | |
|
| | 328 | | /// <summary> Modifies mutable properties on the Event Hubs Cluster. This operation is idempotent. </summary> |
| | 329 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 330 | | /// <param name="clusterName"> The name of the Event Hubs Cluster. </param> |
| | 331 | | /// <param name="parameters"> The properties of the Event Hubs Cluster which should be updated. </param> |
| | 332 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 333 | | public virtual ClustersPatchOperation StartPatch(string resourceGroupName, string clusterName, Cluster parameter |
| | 334 | | { |
| 0 | 335 | | if (resourceGroupName == null) |
| | 336 | | { |
| 0 | 337 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 338 | | } |
| 0 | 339 | | if (clusterName == null) |
| | 340 | | { |
| 0 | 341 | | throw new ArgumentNullException(nameof(clusterName)); |
| | 342 | | } |
| 0 | 343 | | if (parameters == null) |
| | 344 | | { |
| 0 | 345 | | throw new ArgumentNullException(nameof(parameters)); |
| | 346 | | } |
| | 347 | |
|
| 0 | 348 | | using var scope = _clientDiagnostics.CreateScope("ClustersOperations.StartPatch"); |
| 0 | 349 | | scope.Start(); |
| | 350 | | try |
| | 351 | | { |
| 0 | 352 | | var originalResponse = RestClient.Patch(resourceGroupName, clusterName, parameters, cancellationToken); |
| 0 | 353 | | return new ClustersPatchOperation(_clientDiagnostics, _pipeline, RestClient.CreatePatchRequest(resourceG |
| | 354 | | } |
| 0 | 355 | | catch (Exception e) |
| | 356 | | { |
| 0 | 357 | | scope.Failed(e); |
| 0 | 358 | | throw; |
| | 359 | | } |
| 0 | 360 | | } |
| | 361 | |
|
| | 362 | | /// <summary> Deletes an existing Event Hubs Cluster. This operation is idempotent. </summary> |
| | 363 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 364 | | /// <param name="clusterName"> The name of the Event Hubs Cluster. </param> |
| | 365 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 366 | | public virtual async Task<ClustersDeleteOperation> StartDeleteAsync(string resourceGroupName, string clusterName |
| | 367 | | { |
| 0 | 368 | | if (resourceGroupName == null) |
| | 369 | | { |
| 0 | 370 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 371 | | } |
| 0 | 372 | | if (clusterName == null) |
| | 373 | | { |
| 0 | 374 | | throw new ArgumentNullException(nameof(clusterName)); |
| | 375 | | } |
| | 376 | |
|
| 0 | 377 | | using var scope = _clientDiagnostics.CreateScope("ClustersOperations.StartDelete"); |
| 0 | 378 | | scope.Start(); |
| | 379 | | try |
| | 380 | | { |
| 0 | 381 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, clusterName, cancellationToken).C |
| 0 | 382 | | return new ClustersDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourc |
| | 383 | | } |
| 0 | 384 | | catch (Exception e) |
| | 385 | | { |
| 0 | 386 | | scope.Failed(e); |
| 0 | 387 | | throw; |
| | 388 | | } |
| 0 | 389 | | } |
| | 390 | |
|
| | 391 | | /// <summary> Deletes an existing Event Hubs Cluster. This operation is idempotent. </summary> |
| | 392 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 393 | | /// <param name="clusterName"> The name of the Event Hubs Cluster. </param> |
| | 394 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 395 | | public virtual ClustersDeleteOperation StartDelete(string resourceGroupName, string clusterName, CancellationTok |
| | 396 | | { |
| 0 | 397 | | if (resourceGroupName == null) |
| | 398 | | { |
| 0 | 399 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 400 | | } |
| 0 | 401 | | if (clusterName == null) |
| | 402 | | { |
| 0 | 403 | | throw new ArgumentNullException(nameof(clusterName)); |
| | 404 | | } |
| | 405 | |
|
| 0 | 406 | | using var scope = _clientDiagnostics.CreateScope("ClustersOperations.StartDelete"); |
| 0 | 407 | | scope.Start(); |
| | 408 | | try |
| | 409 | | { |
| 0 | 410 | | var originalResponse = RestClient.Delete(resourceGroupName, clusterName, cancellationToken); |
| 0 | 411 | | return new ClustersDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourc |
| | 412 | | } |
| 0 | 413 | | catch (Exception e) |
| | 414 | | { |
| 0 | 415 | | scope.Failed(e); |
| 0 | 416 | | throw; |
| | 417 | | } |
| 0 | 418 | | } |
| | 419 | | } |
| | 420 | | } |