< Summary

Class:Azure.ResourceManager.EventHubs.ClustersOperations
Assembly:Azure.ResourceManager.EventHubs
File(s):C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\ClustersOperations.cs
Covered lines:0
Uncovered lines:164
Coverable lines:164
Total lines:420
Line coverage:0% (0 of 164)
Covered branches:0
Total branches:32
Branch coverage:0% (0 of 32)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-0%100%
.ctor()-0%100%
.ctor(...)-0%100%
ListAvailableClustersAsync()-0%100%
ListAvailableClusters(...)-0%100%
GetAsync()-0%100%
Get(...)-0%100%
ListNamespacesAsync()-0%100%
ListNamespaces(...)-0%100%
ListByResourceGroupAsync(...)-0%0%
<ListByResourceGroupAsync()-0%100%
<ListByResourceGroupAsync()-0%100%
ListByResourceGroup(...)-0%0%
StartPutAsync()-0%0%
StartPut(...)-0%0%
StartPatchAsync()-0%0%
StartPatch(...)-0%0%
StartDeleteAsync()-0%0%
StartDelete(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\ClustersOperations.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Threading;
 10using System.Threading.Tasks;
 11using Azure;
 12using Azure.Core;
 13using Azure.Core.Pipeline;
 14using Azure.ResourceManager.EventHubs.Models;
 15
 16namespace 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;
 023        internal ClustersRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of ClustersOperations for mocking. </summary>
 025        protected ClustersOperations()
 26        {
 027        }
 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>
 033        internal ClustersOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, U
 34        {
 035            RestClient = new ClustersRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 036            _clientDiagnostics = clientDiagnostics;
 037            _pipeline = pipeline;
 038        }
 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        {
 044            using var scope = _clientDiagnostics.CreateScope("ClustersOperations.ListAvailableClusters");
 045            scope.Start();
 46            try
 47            {
 048                return await RestClient.ListAvailableClustersAsync(cancellationToken).ConfigureAwait(false);
 49            }
 050            catch (Exception e)
 51            {
 052                scope.Failed(e);
 053                throw;
 54            }
 055        }
 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        {
 061            using var scope = _clientDiagnostics.CreateScope("ClustersOperations.ListAvailableClusters");
 062            scope.Start();
 63            try
 64            {
 065                return RestClient.ListAvailableClusters(cancellationToken);
 66            }
 067            catch (Exception e)
 68            {
 069                scope.Failed(e);
 070                throw;
 71            }
 072        }
 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        {
 080            using var scope = _clientDiagnostics.CreateScope("ClustersOperations.Get");
 081            scope.Start();
 82            try
 83            {
 084                return await RestClient.GetAsync(resourceGroupName, clusterName, cancellationToken).ConfigureAwait(false
 85            }
 086            catch (Exception e)
 87            {
 088                scope.Failed(e);
 089                throw;
 90            }
 091        }
 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        {
 099            using var scope = _clientDiagnostics.CreateScope("ClustersOperations.Get");
 0100            scope.Start();
 101            try
 102            {
 0103                return RestClient.Get(resourceGroupName, clusterName, cancellationToken);
 104            }
 0105            catch (Exception e)
 106            {
 0107                scope.Failed(e);
 0108                throw;
 109            }
 0110        }
 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        {
 0118            using var scope = _clientDiagnostics.CreateScope("ClustersOperations.ListNamespaces");
 0119            scope.Start();
 120            try
 121            {
 0122                return await RestClient.ListNamespacesAsync(resourceGroupName, clusterName, cancellationToken).Configure
 123            }
 0124            catch (Exception e)
 125            {
 0126                scope.Failed(e);
 0127                throw;
 128            }
 0129        }
 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        {
 0137            using var scope = _clientDiagnostics.CreateScope("ClustersOperations.ListNamespaces");
 0138            scope.Start();
 139            try
 140            {
 0141                return RestClient.ListNamespaces(resourceGroupName, clusterName, cancellationToken);
 142            }
 0143            catch (Exception e)
 144            {
 0145                scope.Failed(e);
 0146                throw;
 147            }
 0148        }
 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        {
 0155            if (resourceGroupName == null)
 156            {
 0157                throw new ArgumentNullException(nameof(resourceGroupName));
 158            }
 159
 160            async Task<Page<Cluster>> FirstPageFunc(int? pageSizeHint)
 161            {
 0162                using var scope = _clientDiagnostics.CreateScope("ClustersOperations.ListByResourceGroup");
 0163                scope.Start();
 164                try
 165                {
 0166                    var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).Confi
 0167                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 168                }
 0169                catch (Exception e)
 170                {
 0171                    scope.Failed(e);
 0172                    throw;
 173                }
 0174            }
 175            async Task<Page<Cluster>> NextPageFunc(string nextLink, int? pageSizeHint)
 176            {
 0177                using var scope = _clientDiagnostics.CreateScope("ClustersOperations.ListByResourceGroup");
 0178                scope.Start();
 179                try
 180                {
 0181                    var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancel
 0182                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 183                }
 0184                catch (Exception e)
 185                {
 0186                    scope.Failed(e);
 0187                    throw;
 188                }
 0189            }
 0190            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        {
 0198            if (resourceGroupName == null)
 199            {
 0200                throw new ArgumentNullException(nameof(resourceGroupName));
 201            }
 202
 203            Page<Cluster> FirstPageFunc(int? pageSizeHint)
 204            {
 0205                using var scope = _clientDiagnostics.CreateScope("ClustersOperations.ListByResourceGroup");
 0206                scope.Start();
 207                try
 208                {
 0209                    var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken);
 0210                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 211                }
 0212                catch (Exception e)
 213                {
 0214                    scope.Failed(e);
 0215                    throw;
 216                }
 0217            }
 218            Page<Cluster> NextPageFunc(string nextLink, int? pageSizeHint)
 219            {
 0220                using var scope = _clientDiagnostics.CreateScope("ClustersOperations.ListByResourceGroup");
 0221                scope.Start();
 222                try
 223                {
 0224                    var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken
 0225                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 226                }
 0227                catch (Exception e)
 228                {
 0229                    scope.Failed(e);
 0230                    throw;
 231                }
 0232            }
 0233            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        {
 0242            if (resourceGroupName == null)
 243            {
 0244                throw new ArgumentNullException(nameof(resourceGroupName));
 245            }
 0246            if (clusterName == null)
 247            {
 0248                throw new ArgumentNullException(nameof(clusterName));
 249            }
 250
 0251            using var scope = _clientDiagnostics.CreateScope("ClustersOperations.StartPut");
 0252            scope.Start();
 253            try
 254            {
 0255                var originalResponse = await RestClient.PutAsync(resourceGroupName, clusterName, cancellationToken).Conf
 0256                return new ClustersPutOperation(_clientDiagnostics, _pipeline, RestClient.CreatePutRequest(resourceGroup
 257            }
 0258            catch (Exception e)
 259            {
 0260                scope.Failed(e);
 0261                throw;
 262            }
 0263        }
 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        {
 0271            if (resourceGroupName == null)
 272            {
 0273                throw new ArgumentNullException(nameof(resourceGroupName));
 274            }
 0275            if (clusterName == null)
 276            {
 0277                throw new ArgumentNullException(nameof(clusterName));
 278            }
 279
 0280            using var scope = _clientDiagnostics.CreateScope("ClustersOperations.StartPut");
 0281            scope.Start();
 282            try
 283            {
 0284                var originalResponse = RestClient.Put(resourceGroupName, clusterName, cancellationToken);
 0285                return new ClustersPutOperation(_clientDiagnostics, _pipeline, RestClient.CreatePutRequest(resourceGroup
 286            }
 0287            catch (Exception e)
 288            {
 0289                scope.Failed(e);
 0290                throw;
 291            }
 0292        }
 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        {
 0301            if (resourceGroupName == null)
 302            {
 0303                throw new ArgumentNullException(nameof(resourceGroupName));
 304            }
 0305            if (clusterName == null)
 306            {
 0307                throw new ArgumentNullException(nameof(clusterName));
 308            }
 0309            if (parameters == null)
 310            {
 0311                throw new ArgumentNullException(nameof(parameters));
 312            }
 313
 0314            using var scope = _clientDiagnostics.CreateScope("ClustersOperations.StartPatch");
 0315            scope.Start();
 316            try
 317            {
 0318                var originalResponse = await RestClient.PatchAsync(resourceGroupName, clusterName, parameters, cancellat
 0319                return new ClustersPatchOperation(_clientDiagnostics, _pipeline, RestClient.CreatePatchRequest(resourceG
 320            }
 0321            catch (Exception e)
 322            {
 0323                scope.Failed(e);
 0324                throw;
 325            }
 0326        }
 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        {
 0335            if (resourceGroupName == null)
 336            {
 0337                throw new ArgumentNullException(nameof(resourceGroupName));
 338            }
 0339            if (clusterName == null)
 340            {
 0341                throw new ArgumentNullException(nameof(clusterName));
 342            }
 0343            if (parameters == null)
 344            {
 0345                throw new ArgumentNullException(nameof(parameters));
 346            }
 347
 0348            using var scope = _clientDiagnostics.CreateScope("ClustersOperations.StartPatch");
 0349            scope.Start();
 350            try
 351            {
 0352                var originalResponse = RestClient.Patch(resourceGroupName, clusterName, parameters, cancellationToken);
 0353                return new ClustersPatchOperation(_clientDiagnostics, _pipeline, RestClient.CreatePatchRequest(resourceG
 354            }
 0355            catch (Exception e)
 356            {
 0357                scope.Failed(e);
 0358                throw;
 359            }
 0360        }
 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        {
 0368            if (resourceGroupName == null)
 369            {
 0370                throw new ArgumentNullException(nameof(resourceGroupName));
 371            }
 0372            if (clusterName == null)
 373            {
 0374                throw new ArgumentNullException(nameof(clusterName));
 375            }
 376
 0377            using var scope = _clientDiagnostics.CreateScope("ClustersOperations.StartDelete");
 0378            scope.Start();
 379            try
 380            {
 0381                var originalResponse = await RestClient.DeleteAsync(resourceGroupName, clusterName, cancellationToken).C
 0382                return new ClustersDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourc
 383            }
 0384            catch (Exception e)
 385            {
 0386                scope.Failed(e);
 0387                throw;
 388            }
 0389        }
 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        {
 0397            if (resourceGroupName == null)
 398            {
 0399                throw new ArgumentNullException(nameof(resourceGroupName));
 400            }
 0401            if (clusterName == null)
 402            {
 0403                throw new ArgumentNullException(nameof(clusterName));
 404            }
 405
 0406            using var scope = _clientDiagnostics.CreateScope("ClustersOperations.StartDelete");
 0407            scope.Start();
 408            try
 409            {
 0410                var originalResponse = RestClient.Delete(resourceGroupName, clusterName, cancellationToken);
 0411                return new ClustersDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourc
 412            }
 0413            catch (Exception e)
 414            {
 0415                scope.Failed(e);
 0416                throw;
 417            }
 0418        }
 419    }
 420}