< Summary

Class:Microsoft.Azure.CognitiveServices.Personalizer.PolicyExtensions
Assembly:Microsoft.Azure.CognitiveServices.Personalizer
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Personalizer\src\Generated\PolicyExtensions.cs
Covered lines:9
Uncovered lines:6
Coverable lines:15
Total lines:191
Line coverage:60% (9 of 15)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
Get(...)-0%100%
GetAsync()-100%100%
GetWithHttpMessages(...)-0%100%
Update(...)-0%100%
UpdateAsync()-100%100%
UpdateWithHttpMessages(...)-0%100%
Reset(...)-0%100%
ResetAsync()-100%100%
ResetWithHttpMessages(...)-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Personalizer\src\Generated\PolicyExtensions.cs

#LineLine coverage
 1// <auto-generated>
 2// Copyright (c) Microsoft Corporation. All rights reserved.
 3// Licensed under the MIT License. See License.txt in the project root for
 4// license information.
 5//
 6// Code generated by Microsoft (R) AutoRest Code Generator.
 7// Changes may cause incorrect behavior and will be lost if the code is
 8// regenerated.
 9// </auto-generated>
 10
 11namespace Microsoft.Azure.CognitiveServices.Personalizer
 12{
 13    using Microsoft.Rest;
 14    using Models;
 15    using System.Collections;
 16    using System.Collections.Generic;
 17    using System.Threading;
 18    using System.Threading.Tasks;
 19
 20    /// <summary>
 21    /// Extension methods for Policy.
 22    /// </summary>
 23    public static partial class PolicyExtensions
 24    {
 25            /// <summary>
 26            /// Get Policy.
 27            /// </summary>
 28            /// <remarks>
 29            /// Get the Learning settings currently used by the Personalizer service.
 30            /// </remarks>
 31            /// <param name='operations'>
 32            /// The operations group for this extension method.
 33            /// </param>
 34            public static PolicyContract Get(this IPolicy operations)
 35            {
 036                return operations.GetAsync().GetAwaiter().GetResult();
 37            }
 38
 39            /// <summary>
 40            /// Get Policy.
 41            /// </summary>
 42            /// <remarks>
 43            /// Get the Learning settings currently used by the Personalizer service.
 44            /// </remarks>
 45            /// <param name='operations'>
 46            /// The operations group for this extension method.
 47            /// </param>
 48            /// <param name='cancellationToken'>
 49            /// The cancellation token.
 50            /// </param>
 51            public static async Task<PolicyContract> GetAsync(this IPolicy operations, CancellationToken cancellationTok
 52            {
 253                using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(f
 54                {
 255                    return _result.Body;
 56                }
 257            }
 58
 59            /// <summary>
 60            /// Get Policy.
 61            /// </summary>
 62            /// <remarks>
 63            /// Get the Learning settings currently used by the Personalizer service.
 64            /// </remarks>
 65            /// <param name='operations'>
 66            /// The operations group for this extension method.
 67            /// </param>
 68            /// <param name='customHeaders'>
 69            /// Headers that will be added to request.
 70            /// </param>
 71            public static HttpOperationResponse<PolicyContract> GetWithHttpMessages(this IPolicy operations, Dictionary<
 72            {
 073                return operations.GetWithHttpMessagesAsync(customHeaders, CancellationToken.None).ConfigureAwait(false).
 74            }
 75
 76            /// <summary>
 77            /// Update Policy.
 78            /// </summary>
 79            /// <remarks>
 80            /// Update the Learning settings that the Personalizer service will use to
 81            /// train models.
 82            /// </remarks>
 83            /// <param name='operations'>
 84            /// The operations group for this extension method.
 85            /// </param>
 86            /// <param name='policy'>
 87            /// The Learning settings.
 88            /// </param>
 89            public static PolicyContract Update(this IPolicy operations, PolicyContract policy)
 90            {
 091                return operations.UpdateAsync(policy).GetAwaiter().GetResult();
 92            }
 93
 94            /// <summary>
 95            /// Update Policy.
 96            /// </summary>
 97            /// <remarks>
 98            /// Update the Learning settings that the Personalizer service will use to
 99            /// train models.
 100            /// </remarks>
 101            /// <param name='operations'>
 102            /// The operations group for this extension method.
 103            /// </param>
 104            /// <param name='policy'>
 105            /// The Learning settings.
 106            /// </param>
 107            /// <param name='cancellationToken'>
 108            /// The cancellation token.
 109            /// </param>
 110            public static async Task<PolicyContract> UpdateAsync(this IPolicy operations, PolicyContract policy, Cancell
 111            {
 2112                using (var _result = await operations.UpdateWithHttpMessagesAsync(policy, null, cancellationToken).Confi
 113                {
 2114                    return _result.Body;
 115                }
 2116            }
 117
 118            /// <summary>
 119            /// Update Policy.
 120            /// </summary>
 121            /// <remarks>
 122            /// Update the Learning settings that the Personalizer service will use to
 123            /// train models.
 124            /// </remarks>
 125            /// <param name='operations'>
 126            /// The operations group for this extension method.
 127            /// </param>
 128            /// <param name='policy'>
 129            /// The Learning settings.
 130            /// </param>
 131            /// <param name='customHeaders'>
 132            /// Headers that will be added to request.
 133            /// </param>
 134            public static HttpOperationResponse<PolicyContract> UpdateWithHttpMessages(this IPolicy operations, PolicyCo
 135            {
 0136                return operations.UpdateWithHttpMessagesAsync(policy, customHeaders, CancellationToken.None).ConfigureAw
 137            }
 138
 139            /// <summary>
 140            /// Reset Policy.
 141            /// </summary>
 142            /// <remarks>
 143            /// Resets the Learning settings of the Personalizer service to default.
 144            /// </remarks>
 145            /// <param name='operations'>
 146            /// The operations group for this extension method.
 147            /// </param>
 148            public static PolicyContract Reset(this IPolicy operations)
 149            {
 0150                return operations.ResetAsync().GetAwaiter().GetResult();
 151            }
 152
 153            /// <summary>
 154            /// Reset Policy.
 155            /// </summary>
 156            /// <remarks>
 157            /// Resets the Learning settings of the Personalizer service to default.
 158            /// </remarks>
 159            /// <param name='operations'>
 160            /// The operations group for this extension method.
 161            /// </param>
 162            /// <param name='cancellationToken'>
 163            /// The cancellation token.
 164            /// </param>
 165            public static async Task<PolicyContract> ResetAsync(this IPolicy operations, CancellationToken cancellationT
 166            {
 2167                using (var _result = await operations.ResetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait
 168                {
 2169                    return _result.Body;
 170                }
 2171            }
 172
 173            /// <summary>
 174            /// Reset Policy.
 175            /// </summary>
 176            /// <remarks>
 177            /// Resets the Learning settings of the Personalizer service to default.
 178            /// </remarks>
 179            /// <param name='operations'>
 180            /// The operations group for this extension method.
 181            /// </param>
 182            /// <param name='customHeaders'>
 183            /// Headers that will be added to request.
 184            /// </param>
 185            public static HttpOperationResponse<PolicyContract> ResetWithHttpMessages(this IPolicy operations, Dictionar
 186            {
 0187                return operations.ResetWithHttpMessagesAsync(customHeaders, CancellationToken.None).ConfigureAwait(false
 188            }
 189
 190    }
 191}