< Summary

Class:Microsoft.Azure.KeyVault.Models.Trigger
Assembly:Microsoft.Azure.KeyVault
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Microsoft.Azure.KeyVault\src\Generated\Models\Trigger.cs
Covered lines:3
Uncovered lines:10
Coverable lines:13
Total lines:85
Line coverage:23% (3 of 13)
Covered branches:0
Total branches:4
Branch coverage:0% (0 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-0%100%
get_LifetimePercentage()-100%100%
get_DaysBeforeExpiry()-0%100%
Validate()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Microsoft.Azure.KeyVault\src\Generated\Models\Trigger.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.KeyVault.Models
 12{
 13    using Microsoft.Rest;
 14    using Newtonsoft.Json;
 15    using System.Linq;
 16
 17    /// <summary>
 18    /// A condition to be satisfied for an action to be executed.
 19    /// </summary>
 20    public partial class Trigger
 21    {
 22        /// <summary>
 23        /// Initializes a new instance of the Trigger class.
 24        /// </summary>
 9625        public Trigger()
 26        {
 27            CustomInit();
 9628        }
 29
 30        /// <summary>
 31        /// Initializes a new instance of the Trigger class.
 32        /// </summary>
 33        /// <param name="lifetimePercentage">Percentage of lifetime at which to
 34        /// trigger. Value should be between 1 and 99.</param>
 35        /// <param name="daysBeforeExpiry">Days before expiry to attempt
 36        /// renewal. Value should be between 1 and validity_in_months
 37        /// multiplied by 27. If validity_in_months is 36, then value should be
 38        /// between 1 and 972 (36 * 27).</param>
 039        public Trigger(int? lifetimePercentage = default(int?), int? daysBeforeExpiry = default(int?))
 40        {
 041            LifetimePercentage = lifetimePercentage;
 042            DaysBeforeExpiry = daysBeforeExpiry;
 43            CustomInit();
 044        }
 45
 46        /// <summary>
 47        /// An initialization method that performs custom operations like setting defaults
 48        /// </summary>
 49        partial void CustomInit();
 50
 51        /// <summary>
 52        /// Gets or sets percentage of lifetime at which to trigger. Value
 53        /// should be between 1 and 99.
 54        /// </summary>
 55        [JsonProperty(PropertyName = "lifetime_percentage")]
 9856        public int? LifetimePercentage { get; set; }
 57
 58        /// <summary>
 59        /// Gets or sets days before expiry to attempt renewal. Value should be
 60        /// between 1 and validity_in_months multiplied by 27. If
 61        /// validity_in_months is 36, then value should be between 1 and 972
 62        /// (36 * 27).
 63        /// </summary>
 64        [JsonProperty(PropertyName = "days_before_expiry")]
 065        public int? DaysBeforeExpiry { get; set; }
 66
 67        /// <summary>
 68        /// Validate the object.
 69        /// </summary>
 70        /// <exception cref="ValidationException">
 71        /// Thrown if validation fails
 72        /// </exception>
 73        public virtual void Validate()
 74        {
 075            if (LifetimePercentage > 99)
 76            {
 077                throw new ValidationException(ValidationRules.InclusiveMaximum, "LifetimePercentage", 99);
 78            }
 079            if (LifetimePercentage < 1)
 80            {
 081                throw new ValidationException(ValidationRules.InclusiveMinimum, "LifetimePercentage", 1);
 82            }
 083        }
 84    }
 85}