< Summary

Class:Azure.ResourceManager.Compute.ProximityPlacementGroupsOperations
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\ProximityPlacementGroupsOperations.cs
Covered lines:24
Uncovered lines:112
Coverable lines:136
Total lines:358
Line coverage:17.6% (24 of 136)
Covered branches:0
Total branches:4
Branch coverage:0% (0 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
CreateOrUpdateAsync()-57.14%100%
CreateOrUpdate(...)-57.14%100%
UpdateAsync()-0%100%
Update(...)-0%100%
DeleteAsync()-0%100%
Delete(...)-0%100%
GetAsync()-57.14%100%
Get(...)-57.14%100%
<ListBySubscriptionAsync()-0%100%
<ListBySubscriptionAsync()-0%100%
ListBySubscriptionAsync(...)-0%100%
ListBySubscription(...)-0%100%
ListByResourceGroupAsync(...)-0%0%
<ListByResourceGroupAsync()-0%100%
<ListByResourceGroupAsync()-0%100%
ListByResourceGroup(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\ProximityPlacementGroupsOperations.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.Compute.Models;
 15
 16namespace Azure.ResourceManager.Compute
 17{
 18    /// <summary> The ProximityPlacementGroups service client. </summary>
 19    public partial class ProximityPlacementGroupsOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 823        internal ProximityPlacementGroupsRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of ProximityPlacementGroupsOperations for mocking. </summary>
 39625        protected ProximityPlacementGroupsOperations()
 26        {
 39627        }
 28        /// <summary> Initializes a new instance of ProximityPlacementGroupsOperations. </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 which uniquely identify Microsoft Azure subscription.
 32        /// <param name="endpoint"> server parameter. </param>
 39633        internal ProximityPlacementGroupsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string s
 34        {
 39635            RestClient = new ProximityPlacementGroupsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoin
 39636            _clientDiagnostics = clientDiagnostics;
 39637            _pipeline = pipeline;
 39638        }
 39
 40        /// <summary> Create or update a proximity placement group. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="proximityPlacementGroupName"> The name of the proximity placement group. </param>
 43        /// <param name="parameters"> Parameters supplied to the Create Proximity Placement Group operation. </param>
 44        /// <param name="cancellationToken"> The cancellation token to use. </param>
 45        public virtual async Task<Response<ProximityPlacementGroup>> CreateOrUpdateAsync(string resourceGroupName, strin
 46        {
 247            using var scope = _clientDiagnostics.CreateScope("ProximityPlacementGroupsOperations.CreateOrUpdate");
 248            scope.Start();
 49            try
 50            {
 251                return await RestClient.CreateOrUpdateAsync(resourceGroupName, proximityPlacementGroupName, parameters, 
 52            }
 053            catch (Exception e)
 54            {
 055                scope.Failed(e);
 056                throw;
 57            }
 258        }
 59
 60        /// <summary> Create or update a proximity placement group. </summary>
 61        /// <param name="resourceGroupName"> The name of the resource group. </param>
 62        /// <param name="proximityPlacementGroupName"> The name of the proximity placement group. </param>
 63        /// <param name="parameters"> Parameters supplied to the Create Proximity Placement Group operation. </param>
 64        /// <param name="cancellationToken"> The cancellation token to use. </param>
 65        public virtual Response<ProximityPlacementGroup> CreateOrUpdate(string resourceGroupName, string proximityPlacem
 66        {
 267            using var scope = _clientDiagnostics.CreateScope("ProximityPlacementGroupsOperations.CreateOrUpdate");
 268            scope.Start();
 69            try
 70            {
 271                return RestClient.CreateOrUpdate(resourceGroupName, proximityPlacementGroupName, parameters, cancellatio
 72            }
 073            catch (Exception e)
 74            {
 075                scope.Failed(e);
 076                throw;
 77            }
 278        }
 79
 80        /// <summary> Update a proximity placement group. </summary>
 81        /// <param name="resourceGroupName"> The name of the resource group. </param>
 82        /// <param name="proximityPlacementGroupName"> The name of the proximity placement group. </param>
 83        /// <param name="parameters"> Parameters supplied to the Update Proximity Placement Group operation. </param>
 84        /// <param name="cancellationToken"> The cancellation token to use. </param>
 85        public virtual async Task<Response<ProximityPlacementGroup>> UpdateAsync(string resourceGroupName, string proxim
 86        {
 087            using var scope = _clientDiagnostics.CreateScope("ProximityPlacementGroupsOperations.Update");
 088            scope.Start();
 89            try
 90            {
 091                return await RestClient.UpdateAsync(resourceGroupName, proximityPlacementGroupName, parameters, cancella
 92            }
 093            catch (Exception e)
 94            {
 095                scope.Failed(e);
 096                throw;
 97            }
 098        }
 99
 100        /// <summary> Update a proximity placement group. </summary>
 101        /// <param name="resourceGroupName"> The name of the resource group. </param>
 102        /// <param name="proximityPlacementGroupName"> The name of the proximity placement group. </param>
 103        /// <param name="parameters"> Parameters supplied to the Update Proximity Placement Group operation. </param>
 104        /// <param name="cancellationToken"> The cancellation token to use. </param>
 105        public virtual Response<ProximityPlacementGroup> Update(string resourceGroupName, string proximityPlacementGroup
 106        {
 0107            using var scope = _clientDiagnostics.CreateScope("ProximityPlacementGroupsOperations.Update");
 0108            scope.Start();
 109            try
 110            {
 0111                return RestClient.Update(resourceGroupName, proximityPlacementGroupName, parameters, cancellationToken);
 112            }
 0113            catch (Exception e)
 114            {
 0115                scope.Failed(e);
 0116                throw;
 117            }
 0118        }
 119
 120        /// <summary> Delete a proximity placement group. </summary>
 121        /// <param name="resourceGroupName"> The name of the resource group. </param>
 122        /// <param name="proximityPlacementGroupName"> The name of the proximity placement group. </param>
 123        /// <param name="cancellationToken"> The cancellation token to use. </param>
 124        public virtual async Task<Response> DeleteAsync(string resourceGroupName, string proximityPlacementGroupName, Ca
 125        {
 0126            using var scope = _clientDiagnostics.CreateScope("ProximityPlacementGroupsOperations.Delete");
 0127            scope.Start();
 128            try
 129            {
 0130                return await RestClient.DeleteAsync(resourceGroupName, proximityPlacementGroupName, cancellationToken).C
 131            }
 0132            catch (Exception e)
 133            {
 0134                scope.Failed(e);
 0135                throw;
 136            }
 0137        }
 138
 139        /// <summary> Delete a proximity placement group. </summary>
 140        /// <param name="resourceGroupName"> The name of the resource group. </param>
 141        /// <param name="proximityPlacementGroupName"> The name of the proximity placement group. </param>
 142        /// <param name="cancellationToken"> The cancellation token to use. </param>
 143        public virtual Response Delete(string resourceGroupName, string proximityPlacementGroupName, CancellationToken c
 144        {
 0145            using var scope = _clientDiagnostics.CreateScope("ProximityPlacementGroupsOperations.Delete");
 0146            scope.Start();
 147            try
 148            {
 0149                return RestClient.Delete(resourceGroupName, proximityPlacementGroupName, cancellationToken);
 150            }
 0151            catch (Exception e)
 152            {
 0153                scope.Failed(e);
 0154                throw;
 155            }
 0156        }
 157
 158        /// <summary> Retrieves information about a proximity placement group . </summary>
 159        /// <param name="resourceGroupName"> The name of the resource group. </param>
 160        /// <param name="proximityPlacementGroupName"> The name of the proximity placement group. </param>
 161        /// <param name="includeColocationStatus"> includeColocationStatus=true enables fetching the colocation status o
 162        /// <param name="cancellationToken"> The cancellation token to use. </param>
 163        public virtual async Task<Response<ProximityPlacementGroup>> GetAsync(string resourceGroupName, string proximity
 164        {
 2165            using var scope = _clientDiagnostics.CreateScope("ProximityPlacementGroupsOperations.Get");
 2166            scope.Start();
 167            try
 168            {
 2169                return await RestClient.GetAsync(resourceGroupName, proximityPlacementGroupName, includeColocationStatus
 170            }
 0171            catch (Exception e)
 172            {
 0173                scope.Failed(e);
 0174                throw;
 175            }
 2176        }
 177
 178        /// <summary> Retrieves information about a proximity placement group . </summary>
 179        /// <param name="resourceGroupName"> The name of the resource group. </param>
 180        /// <param name="proximityPlacementGroupName"> The name of the proximity placement group. </param>
 181        /// <param name="includeColocationStatus"> includeColocationStatus=true enables fetching the colocation status o
 182        /// <param name="cancellationToken"> The cancellation token to use. </param>
 183        public virtual Response<ProximityPlacementGroup> Get(string resourceGroupName, string proximityPlacementGroupNam
 184        {
 2185            using var scope = _clientDiagnostics.CreateScope("ProximityPlacementGroupsOperations.Get");
 2186            scope.Start();
 187            try
 188            {
 2189                return RestClient.Get(resourceGroupName, proximityPlacementGroupName, includeColocationStatus, cancellat
 190            }
 0191            catch (Exception e)
 192            {
 0193                scope.Failed(e);
 0194                throw;
 195            }
 2196        }
 197
 198        /// <summary> Lists all proximity placement groups in a subscription. </summary>
 199        /// <param name="cancellationToken"> The cancellation token to use. </param>
 200        public virtual AsyncPageable<ProximityPlacementGroup> ListBySubscriptionAsync(CancellationToken cancellationToke
 201        {
 202            async Task<Page<ProximityPlacementGroup>> FirstPageFunc(int? pageSizeHint)
 203            {
 0204                using var scope = _clientDiagnostics.CreateScope("ProximityPlacementGroupsOperations.ListBySubscription"
 0205                scope.Start();
 206                try
 207                {
 0208                    var response = await RestClient.ListBySubscriptionAsync(cancellationToken).ConfigureAwait(false);
 0209                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 210                }
 0211                catch (Exception e)
 212                {
 0213                    scope.Failed(e);
 0214                    throw;
 215                }
 0216            }
 217            async Task<Page<ProximityPlacementGroup>> NextPageFunc(string nextLink, int? pageSizeHint)
 218            {
 0219                using var scope = _clientDiagnostics.CreateScope("ProximityPlacementGroupsOperations.ListBySubscription"
 0220                scope.Start();
 221                try
 222                {
 0223                    var response = await RestClient.ListBySubscriptionNextPageAsync(nextLink, cancellationToken).Configu
 0224                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 225                }
 0226                catch (Exception e)
 227                {
 0228                    scope.Failed(e);
 0229                    throw;
 230                }
 0231            }
 0232            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 233        }
 234
 235        /// <summary> Lists all proximity placement groups in a subscription. </summary>
 236        /// <param name="cancellationToken"> The cancellation token to use. </param>
 237        public virtual Pageable<ProximityPlacementGroup> ListBySubscription(CancellationToken cancellationToken = defaul
 238        {
 239            Page<ProximityPlacementGroup> FirstPageFunc(int? pageSizeHint)
 240            {
 0241                using var scope = _clientDiagnostics.CreateScope("ProximityPlacementGroupsOperations.ListBySubscription"
 0242                scope.Start();
 243                try
 244                {
 0245                    var response = RestClient.ListBySubscription(cancellationToken);
 0246                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 247                }
 0248                catch (Exception e)
 249                {
 0250                    scope.Failed(e);
 0251                    throw;
 252                }
 0253            }
 254            Page<ProximityPlacementGroup> NextPageFunc(string nextLink, int? pageSizeHint)
 255            {
 0256                using var scope = _clientDiagnostics.CreateScope("ProximityPlacementGroupsOperations.ListBySubscription"
 0257                scope.Start();
 258                try
 259                {
 0260                    var response = RestClient.ListBySubscriptionNextPage(nextLink, cancellationToken);
 0261                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 262                }
 0263                catch (Exception e)
 264                {
 0265                    scope.Failed(e);
 0266                    throw;
 267                }
 0268            }
 0269            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 270        }
 271
 272        /// <summary> Lists all proximity placement groups in a resource group. </summary>
 273        /// <param name="resourceGroupName"> The name of the resource group. </param>
 274        /// <param name="cancellationToken"> The cancellation token to use. </param>
 275        public virtual AsyncPageable<ProximityPlacementGroup> ListByResourceGroupAsync(string resourceGroupName, Cancell
 276        {
 0277            if (resourceGroupName == null)
 278            {
 0279                throw new ArgumentNullException(nameof(resourceGroupName));
 280            }
 281
 282            async Task<Page<ProximityPlacementGroup>> FirstPageFunc(int? pageSizeHint)
 283            {
 0284                using var scope = _clientDiagnostics.CreateScope("ProximityPlacementGroupsOperations.ListByResourceGroup
 0285                scope.Start();
 286                try
 287                {
 0288                    var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).Confi
 0289                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 290                }
 0291                catch (Exception e)
 292                {
 0293                    scope.Failed(e);
 0294                    throw;
 295                }
 0296            }
 297            async Task<Page<ProximityPlacementGroup>> NextPageFunc(string nextLink, int? pageSizeHint)
 298            {
 0299                using var scope = _clientDiagnostics.CreateScope("ProximityPlacementGroupsOperations.ListByResourceGroup
 0300                scope.Start();
 301                try
 302                {
 0303                    var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancel
 0304                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 305                }
 0306                catch (Exception e)
 307                {
 0308                    scope.Failed(e);
 0309                    throw;
 310                }
 0311            }
 0312            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 313        }
 314
 315        /// <summary> Lists all proximity placement groups in a resource group. </summary>
 316        /// <param name="resourceGroupName"> The name of the resource group. </param>
 317        /// <param name="cancellationToken"> The cancellation token to use. </param>
 318        public virtual Pageable<ProximityPlacementGroup> ListByResourceGroup(string resourceGroupName, CancellationToken
 319        {
 0320            if (resourceGroupName == null)
 321            {
 0322                throw new ArgumentNullException(nameof(resourceGroupName));
 323            }
 324
 325            Page<ProximityPlacementGroup> FirstPageFunc(int? pageSizeHint)
 326            {
 0327                using var scope = _clientDiagnostics.CreateScope("ProximityPlacementGroupsOperations.ListByResourceGroup
 0328                scope.Start();
 329                try
 330                {
 0331                    var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken);
 0332                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 333                }
 0334                catch (Exception e)
 335                {
 0336                    scope.Failed(e);
 0337                    throw;
 338                }
 0339            }
 340            Page<ProximityPlacementGroup> NextPageFunc(string nextLink, int? pageSizeHint)
 341            {
 0342                using var scope = _clientDiagnostics.CreateScope("ProximityPlacementGroupsOperations.ListByResourceGroup
 0343                scope.Start();
 344                try
 345                {
 0346                    var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken
 0347                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 348                }
 0349                catch (Exception e)
 350                {
 0351                    scope.Failed(e);
 0352                    throw;
 353                }
 0354            }
 0355            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 356        }
 357    }
 358}