< Summary

Class:Azure.ResourceManager.Network.BastionHostsOperations
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\BastionHostsOperations.cs
Covered lines:0
Uncovered lines:146
Coverable lines:146
Total lines:364
Line coverage:0% (0 of 146)
Covered branches:0
Total branches:24
Branch coverage:0% (0 of 24)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-0%100%
.ctor()-0%100%
.ctor(...)-0%100%
GetAsync()-0%100%
Get(...)-0%100%
<ListAsync()-0%100%
<ListAsync()-0%100%
ListAsync(...)-0%100%
List(...)-0%100%
ListByResourceGroupAsync(...)-0%0%
<ListByResourceGroupAsync()-0%100%
<ListByResourceGroupAsync()-0%100%
ListByResourceGroup(...)-0%0%
StartDeleteAsync()-0%0%
StartDelete(...)-0%0%
StartCreateOrUpdateAsync()-0%0%
StartCreateOrUpdate(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\BastionHostsOperations.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.Network.Models;
 15
 16namespace Azure.ResourceManager.Network
 17{
 18    /// <summary> The BastionHosts service client. </summary>
 19    public partial class BastionHostsOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 023        internal BastionHostsRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of BastionHostsOperations for mocking. </summary>
 025        protected BastionHostsOperations()
 26        {
 027        }
 28        /// <summary> Initializes a new instance of BastionHostsOperations. </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>
 033        internal BastionHostsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionI
 34        {
 035            RestClient = new BastionHostsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 036            _clientDiagnostics = clientDiagnostics;
 037            _pipeline = pipeline;
 038        }
 39
 40        /// <summary> Gets the specified Bastion Host. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="bastionHostName"> The name of the Bastion Host. </param>
 43        /// <param name="cancellationToken"> The cancellation token to use. </param>
 44        public virtual async Task<Response<BastionHost>> GetAsync(string resourceGroupName, string bastionHostName, Canc
 45        {
 046            using var scope = _clientDiagnostics.CreateScope("BastionHostsOperations.Get");
 047            scope.Start();
 48            try
 49            {
 050                return await RestClient.GetAsync(resourceGroupName, bastionHostName, cancellationToken).ConfigureAwait(f
 51            }
 052            catch (Exception e)
 53            {
 054                scope.Failed(e);
 055                throw;
 56            }
 057        }
 58
 59        /// <summary> Gets the specified Bastion Host. </summary>
 60        /// <param name="resourceGroupName"> The name of the resource group. </param>
 61        /// <param name="bastionHostName"> The name of the Bastion Host. </param>
 62        /// <param name="cancellationToken"> The cancellation token to use. </param>
 63        public virtual Response<BastionHost> Get(string resourceGroupName, string bastionHostName, CancellationToken can
 64        {
 065            using var scope = _clientDiagnostics.CreateScope("BastionHostsOperations.Get");
 066            scope.Start();
 67            try
 68            {
 069                return RestClient.Get(resourceGroupName, bastionHostName, cancellationToken);
 70            }
 071            catch (Exception e)
 72            {
 073                scope.Failed(e);
 074                throw;
 75            }
 076        }
 77
 78        /// <summary> Lists all Bastion Hosts in a subscription. </summary>
 79        /// <param name="cancellationToken"> The cancellation token to use. </param>
 80        public virtual AsyncPageable<BastionHost> ListAsync(CancellationToken cancellationToken = default)
 81        {
 82            async Task<Page<BastionHost>> FirstPageFunc(int? pageSizeHint)
 83            {
 084                using var scope = _clientDiagnostics.CreateScope("BastionHostsOperations.List");
 085                scope.Start();
 86                try
 87                {
 088                    var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
 089                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 90                }
 091                catch (Exception e)
 92                {
 093                    scope.Failed(e);
 094                    throw;
 95                }
 096            }
 97            async Task<Page<BastionHost>> NextPageFunc(string nextLink, int? pageSizeHint)
 98            {
 099                using var scope = _clientDiagnostics.CreateScope("BastionHostsOperations.List");
 0100                scope.Start();
 101                try
 102                {
 0103                    var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false)
 0104                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 105                }
 0106                catch (Exception e)
 107                {
 0108                    scope.Failed(e);
 0109                    throw;
 110                }
 0111            }
 0112            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 113        }
 114
 115        /// <summary> Lists all Bastion Hosts in a subscription. </summary>
 116        /// <param name="cancellationToken"> The cancellation token to use. </param>
 117        public virtual Pageable<BastionHost> List(CancellationToken cancellationToken = default)
 118        {
 119            Page<BastionHost> FirstPageFunc(int? pageSizeHint)
 120            {
 0121                using var scope = _clientDiagnostics.CreateScope("BastionHostsOperations.List");
 0122                scope.Start();
 123                try
 124                {
 0125                    var response = RestClient.List(cancellationToken);
 0126                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 127                }
 0128                catch (Exception e)
 129                {
 0130                    scope.Failed(e);
 0131                    throw;
 132                }
 0133            }
 134            Page<BastionHost> NextPageFunc(string nextLink, int? pageSizeHint)
 135            {
 0136                using var scope = _clientDiagnostics.CreateScope("BastionHostsOperations.List");
 0137                scope.Start();
 138                try
 139                {
 0140                    var response = RestClient.ListNextPage(nextLink, cancellationToken);
 0141                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 142                }
 0143                catch (Exception e)
 144                {
 0145                    scope.Failed(e);
 0146                    throw;
 147                }
 0148            }
 0149            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 150        }
 151
 152        /// <summary> Lists all Bastion Hosts in a resource group. </summary>
 153        /// <param name="resourceGroupName"> The name of the resource group. </param>
 154        /// <param name="cancellationToken"> The cancellation token to use. </param>
 155        public virtual AsyncPageable<BastionHost> ListByResourceGroupAsync(string resourceGroupName, CancellationToken c
 156        {
 0157            if (resourceGroupName == null)
 158            {
 0159                throw new ArgumentNullException(nameof(resourceGroupName));
 160            }
 161
 162            async Task<Page<BastionHost>> FirstPageFunc(int? pageSizeHint)
 163            {
 0164                using var scope = _clientDiagnostics.CreateScope("BastionHostsOperations.ListByResourceGroup");
 0165                scope.Start();
 166                try
 167                {
 0168                    var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).Confi
 0169                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 170                }
 0171                catch (Exception e)
 172                {
 0173                    scope.Failed(e);
 0174                    throw;
 175                }
 0176            }
 177            async Task<Page<BastionHost>> NextPageFunc(string nextLink, int? pageSizeHint)
 178            {
 0179                using var scope = _clientDiagnostics.CreateScope("BastionHostsOperations.ListByResourceGroup");
 0180                scope.Start();
 181                try
 182                {
 0183                    var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancel
 0184                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 185                }
 0186                catch (Exception e)
 187                {
 0188                    scope.Failed(e);
 0189                    throw;
 190                }
 0191            }
 0192            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 193        }
 194
 195        /// <summary> Lists all Bastion Hosts in a resource group. </summary>
 196        /// <param name="resourceGroupName"> The name of the resource group. </param>
 197        /// <param name="cancellationToken"> The cancellation token to use. </param>
 198        public virtual Pageable<BastionHost> ListByResourceGroup(string resourceGroupName, CancellationToken cancellatio
 199        {
 0200            if (resourceGroupName == null)
 201            {
 0202                throw new ArgumentNullException(nameof(resourceGroupName));
 203            }
 204
 205            Page<BastionHost> FirstPageFunc(int? pageSizeHint)
 206            {
 0207                using var scope = _clientDiagnostics.CreateScope("BastionHostsOperations.ListByResourceGroup");
 0208                scope.Start();
 209                try
 210                {
 0211                    var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken);
 0212                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 213                }
 0214                catch (Exception e)
 215                {
 0216                    scope.Failed(e);
 0217                    throw;
 218                }
 0219            }
 220            Page<BastionHost> NextPageFunc(string nextLink, int? pageSizeHint)
 221            {
 0222                using var scope = _clientDiagnostics.CreateScope("BastionHostsOperations.ListByResourceGroup");
 0223                scope.Start();
 224                try
 225                {
 0226                    var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken
 0227                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 228                }
 0229                catch (Exception e)
 230                {
 0231                    scope.Failed(e);
 0232                    throw;
 233                }
 0234            }
 0235            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 236        }
 237
 238        /// <summary> Deletes the specified Bastion Host. </summary>
 239        /// <param name="resourceGroupName"> The name of the resource group. </param>
 240        /// <param name="bastionHostName"> The name of the Bastion Host. </param>
 241        /// <param name="cancellationToken"> The cancellation token to use. </param>
 242        public virtual async Task<BastionHostsDeleteOperation> StartDeleteAsync(string resourceGroupName, string bastion
 243        {
 0244            if (resourceGroupName == null)
 245            {
 0246                throw new ArgumentNullException(nameof(resourceGroupName));
 247            }
 0248            if (bastionHostName == null)
 249            {
 0250                throw new ArgumentNullException(nameof(bastionHostName));
 251            }
 252
 0253            using var scope = _clientDiagnostics.CreateScope("BastionHostsOperations.StartDelete");
 0254            scope.Start();
 255            try
 256            {
 0257                var originalResponse = await RestClient.DeleteAsync(resourceGroupName, bastionHostName, cancellationToke
 0258                return new BastionHostsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(res
 259            }
 0260            catch (Exception e)
 261            {
 0262                scope.Failed(e);
 0263                throw;
 264            }
 0265        }
 266
 267        /// <summary> Deletes the specified Bastion Host. </summary>
 268        /// <param name="resourceGroupName"> The name of the resource group. </param>
 269        /// <param name="bastionHostName"> The name of the Bastion Host. </param>
 270        /// <param name="cancellationToken"> The cancellation token to use. </param>
 271        public virtual BastionHostsDeleteOperation StartDelete(string resourceGroupName, string bastionHostName, Cancell
 272        {
 0273            if (resourceGroupName == null)
 274            {
 0275                throw new ArgumentNullException(nameof(resourceGroupName));
 276            }
 0277            if (bastionHostName == null)
 278            {
 0279                throw new ArgumentNullException(nameof(bastionHostName));
 280            }
 281
 0282            using var scope = _clientDiagnostics.CreateScope("BastionHostsOperations.StartDelete");
 0283            scope.Start();
 284            try
 285            {
 0286                var originalResponse = RestClient.Delete(resourceGroupName, bastionHostName, cancellationToken);
 0287                return new BastionHostsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(res
 288            }
 0289            catch (Exception e)
 290            {
 0291                scope.Failed(e);
 0292                throw;
 293            }
 0294        }
 295
 296        /// <summary> Creates or updates the specified Bastion Host. </summary>
 297        /// <param name="resourceGroupName"> The name of the resource group. </param>
 298        /// <param name="bastionHostName"> The name of the Bastion Host. </param>
 299        /// <param name="parameters"> Parameters supplied to the create or update Bastion Host operation. </param>
 300        /// <param name="cancellationToken"> The cancellation token to use. </param>
 301        public virtual async Task<BastionHostsCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroupName
 302        {
 0303            if (resourceGroupName == null)
 304            {
 0305                throw new ArgumentNullException(nameof(resourceGroupName));
 306            }
 0307            if (bastionHostName == null)
 308            {
 0309                throw new ArgumentNullException(nameof(bastionHostName));
 310            }
 0311            if (parameters == null)
 312            {
 0313                throw new ArgumentNullException(nameof(parameters));
 314            }
 315
 0316            using var scope = _clientDiagnostics.CreateScope("BastionHostsOperations.StartCreateOrUpdate");
 0317            scope.Start();
 318            try
 319            {
 0320                var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, bastionHostName, paramete
 0321                return new BastionHostsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrU
 322            }
 0323            catch (Exception e)
 324            {
 0325                scope.Failed(e);
 0326                throw;
 327            }
 0328        }
 329
 330        /// <summary> Creates or updates the specified Bastion Host. </summary>
 331        /// <param name="resourceGroupName"> The name of the resource group. </param>
 332        /// <param name="bastionHostName"> The name of the Bastion Host. </param>
 333        /// <param name="parameters"> Parameters supplied to the create or update Bastion Host operation. </param>
 334        /// <param name="cancellationToken"> The cancellation token to use. </param>
 335        public virtual BastionHostsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string bastionH
 336        {
 0337            if (resourceGroupName == null)
 338            {
 0339                throw new ArgumentNullException(nameof(resourceGroupName));
 340            }
 0341            if (bastionHostName == null)
 342            {
 0343                throw new ArgumentNullException(nameof(bastionHostName));
 344            }
 0345            if (parameters == null)
 346            {
 0347                throw new ArgumentNullException(nameof(parameters));
 348            }
 349
 0350            using var scope = _clientDiagnostics.CreateScope("BastionHostsOperations.StartCreateOrUpdate");
 0351            scope.Start();
 352            try
 353            {
 0354                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, bastionHostName, parameters, cancell
 0355                return new BastionHostsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrU
 356            }
 0357            catch (Exception e)
 358            {
 0359                scope.Failed(e);
 0360                throw;
 361            }
 0362        }
 363    }
 364}