| | | 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 | | |
| | | 11 | | namespace 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> |
| | 96 | 25 | | public Trigger() |
| | | 26 | | { |
| | | 27 | | CustomInit(); |
| | 96 | 28 | | } |
| | | 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> |
| | 0 | 39 | | public Trigger(int? lifetimePercentage = default(int?), int? daysBeforeExpiry = default(int?)) |
| | | 40 | | { |
| | 0 | 41 | | LifetimePercentage = lifetimePercentage; |
| | 0 | 42 | | DaysBeforeExpiry = daysBeforeExpiry; |
| | | 43 | | CustomInit(); |
| | 0 | 44 | | } |
| | | 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")] |
| | 98 | 56 | | 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")] |
| | 0 | 65 | | 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 | | { |
| | 0 | 75 | | if (LifetimePercentage > 99) |
| | | 76 | | { |
| | 0 | 77 | | throw new ValidationException(ValidationRules.InclusiveMaximum, "LifetimePercentage", 99); |
| | | 78 | | } |
| | 0 | 79 | | if (LifetimePercentage < 1) |
| | | 80 | | { |
| | 0 | 81 | | throw new ValidationException(ValidationRules.InclusiveMinimum, "LifetimePercentage", 1); |
| | | 82 | | } |
| | 0 | 83 | | } |
| | | 84 | | } |
| | | 85 | | } |