| | 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 Microsoft.Rest.Serialization; |
| | 15 | | using Newtonsoft.Json; |
| | 16 | | using System.Linq; |
| | 17 | |
|
| | 18 | | /// <summary> |
| | 19 | | /// The key operations parameters. |
| | 20 | | /// </summary> |
| | 21 | | public partial class KeyOperationsParameters |
| | 22 | | { |
| | 23 | | /// <summary> |
| | 24 | | /// Initializes a new instance of the KeyOperationsParameters class. |
| | 25 | | /// </summary> |
| 32 | 26 | | public KeyOperationsParameters() |
| | 27 | | { |
| | 28 | | CustomInit(); |
| 32 | 29 | | } |
| | 30 | |
|
| | 31 | | /// <summary> |
| | 32 | | /// Initializes a new instance of the KeyOperationsParameters class. |
| | 33 | | /// </summary> |
| | 34 | | /// <param name="algorithm">algorithm identifier. Possible values |
| | 35 | | /// include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5'</param> |
| 0 | 36 | | public KeyOperationsParameters(string algorithm, byte[] value) |
| | 37 | | { |
| 0 | 38 | | Algorithm = algorithm; |
| 0 | 39 | | Value = value; |
| | 40 | | CustomInit(); |
| 0 | 41 | | } |
| | 42 | |
|
| | 43 | | /// <summary> |
| | 44 | | /// An initialization method that performs custom operations like setting defaults |
| | 45 | | /// </summary> |
| | 46 | | partial void CustomInit(); |
| | 47 | |
|
| | 48 | | /// <summary> |
| | 49 | | /// Gets or sets algorithm identifier. Possible values include: |
| | 50 | | /// 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' |
| | 51 | | /// </summary> |
| | 52 | | [JsonProperty(PropertyName = "alg")] |
| 64 | 53 | | public string Algorithm { get; set; } |
| | 54 | |
|
| | 55 | | /// <summary> |
| | 56 | | /// </summary> |
| | 57 | | [JsonConverter(typeof(Base64UrlJsonConverter))] |
| | 58 | | [JsonProperty(PropertyName = "value")] |
| 64 | 59 | | public byte[] Value { get; set; } |
| | 60 | |
|
| | 61 | | /// <summary> |
| | 62 | | /// Validate the object. |
| | 63 | | /// </summary> |
| | 64 | | /// <exception cref="ValidationException"> |
| | 65 | | /// Thrown if validation fails |
| | 66 | | /// </exception> |
| | 67 | | public virtual void Validate() |
| | 68 | | { |
| 0 | 69 | | if (Algorithm == null) |
| | 70 | | { |
| 0 | 71 | | throw new ValidationException(ValidationRules.CannotBeNull, "Algorithm"); |
| | 72 | | } |
| 0 | 73 | | if (Value == null) |
| | 74 | | { |
| 0 | 75 | | throw new ValidationException(ValidationRules.CannotBeNull, "Value"); |
| | 76 | | } |
| 0 | 77 | | if (Algorithm != null) |
| | 78 | | { |
| 0 | 79 | | if (Algorithm.Length < 1) |
| | 80 | | { |
| 0 | 81 | | throw new ValidationException(ValidationRules.MinLength, "Algorithm", 1); |
| | 82 | | } |
| | 83 | | } |
| 0 | 84 | | } |
| | 85 | | } |
| | 86 | | } |